Click or drag to resize
StringReplace 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.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public string Replace(
	string oldValue,
	string newValue
)

Parameters

oldValue
Type: SystemString
The string to be replaced.
newValue
Type: SystemString
The string to replace all occurrences of oldValue.

Return Value

Type: String
A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue.
Exceptions
ExceptionCondition
ArgumentNullExceptionoldValue is null.
ArgumentExceptionoldValue is the empty string ("").
See Also