String.Replace Method (String, String)
Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.
Assembly: mscorlib (in mscorlib.dll)
The string to be replaced.
The string to replace all occurrences of oldValue.
Return ValueType: System.String
A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue. If oldValue is not found in the current instance, the method returns the current instance unchanged.
If newValue is null, all occurrences of oldValue are removed.
This method does not modify the value of the current instance. Instead, it returns a new string in which all occurrences of oldValue are replaced by newValue.
This method performs an ordinal (case-sensitive and culture-insensitive) search to find oldValue.
Because this method returns the modified string, you can chain together successive calls to the Replace method to perform multiple replacements on the original string. Method calls are executed from left to right. The following example provides an illustration.
Available since 8
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1