Replace Method (String, String, Int32, Int32)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Replaces, within a substring of this instance, all occurrences of a specified string with another specified string.

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)

public StringBuilder Replace(
	string oldValue,
	string newValue,
	int startIndex,
	int count


Type: System..::..String
The string to replace.
Type: System..::..String
The string that replaces oldValue, or nullNothingnullptrunita null reference (Nothing in Visual Basic).
Type: System..::..Int32
The position in this instance where the substring begins.
Type: System..::..Int32
The length of the substring.

Return Value

Type: System.Text..::..StringBuilder
A reference to this instance with all instances of oldValue replaced by newValue in the range from startIndex to startIndex + count - 1.

The strings to replace are checked on an ordinal basis; that is, the replacement is not culture-aware. If newValue is nullNothingnullptrunita null reference (Nothing in Visual Basic) or String..::..Empty, all occurrences of oldValue are removed. This method is case-sensitive.