Mono Class Library: System.Text.StringBuilder Overview | Members

System.Text.StringBuilder.Replace Method

Replaces all instances of a specified character in a specified range with another specified character.

public StringBuilder Replace (char oldChar, char newChar, int startIndex, int count)

Parameters

oldChar
The char to replace.
newChar
The char with which to replace oldChar .
startIndex
A int containing the index from which to start replacing oldChar.
count
A int containing the length of the range in which to replace oldChar .

Returns

The current instance after substitution has occurred.

Exceptions

TypeReason
ArgumentOutOfRangeException

The sum of startIndex and count is larger than the length of the current instance

-or-

startIndex or count is less than zero.

Remarks

This method substitutes each occurrence of oldChar in the specified range of the current instance with newChar.

This method is case-sensitive.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0