string str="John is 50 years old"; string str2 = str.Replace('s', 't'); //str2=John it 50 yeart old //--------------------------------- string str="John is 50 years old"; string str2 = str.Replace("is", "should be"); //John should be 50 years old
using System.Text.RegularExpressions; string str = "csharp regular expression"; str = Regex.Replace(str, @"regular ", ""); //csharp expression