Click or drag to resize
StringBuilderReplace Method (String, String)
Replaces all occurrences of a specified string in this instance with another specified string.

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

Parameters

oldValue
Type: SystemString
The string to replace.
newValue
Type: SystemString
The string that replaces oldValue, or null.

Return Value

Type: StringBuilder
A reference to this instance with all instances of oldValue replaced by newValue.
Exceptions
ExceptionCondition
ArgumentNullExceptionoldValue is null.
ArgumentExceptionThe length of oldValue is zero.
ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed MaxCapacity.
See Also