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 (String, String, Int32, Int32)

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

[Visual Basic]
Overloads Public Function Replace( _
   ByVal oldValue As String, _
   ByVal newValue As String, _
   ByVal startIndex As Integer, _
   ByVal count As Integer _
) As StringBuilder
[C#]
public StringBuilder Replace(
   string oldValue,
   string newValue,
   int startIndex,
   int count
);
[C++]
public: StringBuilder* Replace(
   String* oldValue,
   String* newValue,
   int startIndex,
   int count
);
[JScript]
public function Replace(
   oldValue : String,
   newValue : String,
   startIndex : int,
   count : int
) : StringBuilder;

Parameters

oldValue
The string to replace.
newValue
The string with which to replace oldValue.
startIndex
The location from which to start searching.
count
The length of the range in which to replace.

Return Value

A reference to the current StringBuilder with all instances of oldValue replaced with newValue in the range from startIndex to startIndex + count- 1.

Exceptions

Exception Type Condition
ArgumentNullException oldValue is a null reference (in Visual Basic Nothing).

startIndex and count don't specify a valid range.

Remarks

The strings to be replaced are checked on an ordinal basis (e.g. not locale aware). If newValue is a null reference (Nothing), instances of oldValue are removed (e.g. replaced with nothing.). This method is case-sensitive.

See Also

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