Share via


Replace Method (Char, Char, 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 character with another specified character.

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

Syntax

'Declaration
Public Function Replace ( _
    oldChar As Char, _
    newChar As Char, _
    startIndex As Integer, _
    count As Integer _
) As StringBuilder
public StringBuilder Replace(
    char oldChar,
    char newChar,
    int startIndex,
    int count
)
public:
StringBuilder^ Replace(
    wchar_t oldChar, 
    wchar_t newChar, 
    int startIndex, 
    int count
)
member Replace : 
        oldChar:char * 
        newChar:char * 
        startIndex:int * 
        count:int -> StringBuilder 
public function Replace(
    oldChar : char, 
    newChar : char, 
    startIndex : int, 
    count : int
) : StringBuilder

Parameters

Return Value

Type: System.Text. . :: . .StringBuilder
A reference to this instance with oldChar replaced by newChar in the range from startIndex to startIndex + count -1.

Remarks

The size of the StringBuilder is unchanged because characters are only replaced. This method is case-sensitive.

.NET Framework Security

See Also

Reference

StringBuilder Class

Replace Overload

System.Text Namespace