Returns a new string with all occurrences of a value replaced.
Syntax
str.Replace(oldValue, newValue)Example
Enter values below to update the example in real time.
string→result→Console→WriteLine→string text = "Hello World World";
string result = text.Replace("World", "C#");
Console.WriteLine(result); // "Hello C# C#"