String.Replace Method (Char, Char)
Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another specified Unicode character.
Assembly: mscorlib (in mscorlib.dll)
The Unicode character to be replaced.
The Unicode character to replace all occurrences of oldChar.
Return ValueType: System.String
A string that is equivalent to this instance except that all instances of oldChar are replaced with newChar. If oldChar is not found in the current instance, the method returns the current instance unchanged.
This method performs an ordinal (case-sensitive and culture-insensitive) search to find oldChar.
This method does not modify the value of the current instance. Instead, it returns a new string in which all occurrences of oldChar are replaced by newChar.
Because this method returns the modified string, you can chain together successive calls to themethod 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