Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[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)
Syntax
'Declaration
Public Function Replace ( _
oldValue As String, _
newValue As String, _
startIndex As Integer, _
count As Integer _
) As StringBuilder
public StringBuilder Replace(
string oldValue,
string newValue,
int startIndex,
int count
)
public:
StringBuilder^ Replace(
String^ oldValue,
String^ newValue,
int startIndex,
int count
)
member Replace :
oldValue:string *
newValue:string *
startIndex:int *
count:int -> StringBuilder
public function Replace(
oldValue : String,
newValue : String,
startIndex : int,
count : int
) : StringBuilder
Parameters
- oldValue
Type: System. . :: . .String
The string to replace.
- newValue
Type: System. . :: . .String
The string that replaces oldValue, or nullNothingnullptrunita null reference (Nothing in Visual Basic).
- startIndex
Type: System. . :: . .Int32
The position in this instance where the substring begins.
- count
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.
Remarks
The strings to replace are checked on an ordinal basis; that is, the replacement is not culture-aware. If newValue is null Nothing nullptr unit a null reference (Nothing in Visual Basic) or String..::..Empty, all occurrences of oldValue are removed. This method is case-sensitive.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.