Mega Code Archive

 
Categories / C# Book / 02 Essential Types
 

0242 Replacing substring

Replace method from string type replaces the found substring with specified string. using System; class Sample { public static void Main() { string s = "rntsoft.com"; s = s.Replace("rnt", "RNT"); Console.WriteLine(s); } } The output: RNTsoft.com