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;
A reference to the current StringBuilder with all instances of oldValue replaced with newValue in the range from startIndex to startIndex + count- 1.
Exception Type | Condition |
---|---|
ArgumentNullException | oldValue is a null reference (in Visual Basic Nothing).
startIndex and count don't specify a valid range. |
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.
StringBuilder Class | StringBuilder Members | System.Text Namespace | StringBuilder.Replace Overload List