NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

StringBuilder.Replace (Char, Char, Int32, Int32)

A StringBuilder with all instances of a specified character in a specified range replaced with a new character.

[Visual Basic]
Overloads Public Function Replace( _
   ByVal oldChar As Char, _
   ByVal newChar As Char, _
   ByVal startIndex As Integer, _
   ByVal count As Integer _
) As StringBuilder
[C#]
public StringBuilder Replace(
   char oldChar,
   char newChar,
   int startIndex,
   int count
);
[C++]
public: StringBuilder* Replace(
   __wchar_t oldChar,
   __wchar_t newChar,
   int startIndex,
   int count
);
[JScript]
public function Replace(
   oldChar : Char,
   newChar : Char,
   startIndex : int,
   count : int
) : StringBuilder;

Parameters

oldChar
The character to replace.
newChar
The character with which to replace oldChar.
startIndex
The index from which to start the replace.
count
The length of the range in which to replace.

Return Value

A StringBuilder with oldChar replaced with newChar in the specified range.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException if startIndex and count do not specify a valid range.

Remarks

The size of the StringBuilder is unchanged because we're only replacing characters. We only replace characters in the range from startIndex to startIndex + count- 1. This method is case-sensitive.

See Also

StringBuilder Class | StringBuilder Members | System.Text Namespace | StringBuilder.Replace Overload List