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. [Edit]

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

Parameters

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

Returns

The current instance after substitution has occurred. [Edit]

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.

[Edit]

Remarks

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

This method is case-sensitive.

[Edit]

Requirements

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