String.Replace Method in C#
To replace a string in C# you can use methodReplace()
which returns a new string in which all occurrences of a specified Unicode character or String in the current string are replaced with another specified Unicode character or String.Example
using System;
public class Client
{
public static void Main()
{
string s = "hello User";
s = s.Replace("User", "Jhon");
Console.WriteLine(s);
}
}
Output
hello Jhon