you try with :
Program that uses Replace: C#
using System;
class Program
{
static void Main()
{
const string s = "Darth Vader is scary.";
Console.WriteLine(s);
string v = s.Replace("scary", "not scary");
Console.WriteLine(v);
}
}
Output
Darth Vader is scary.
Darth Vader is not scary.
Program that uses Remove: C#
using System;
class Program
{
static void Main()
{
string test1 = "0123456";
string result1 = test1.Remove(3);
Console.WriteLine(result1);
string test2 = "012 345 678";
int index1 = test2.IndexOf(' ');
int index2 = test2.IndexOf(' ', index1 + 1);
string result2 = test2.Remove(index1, index2 - index1);
Console.WriteLine(result2);
}
}
Output
012
012 678