Replace Method (Char, Char)
Collapse the table of content
Expand the table of content

StringBuilder.Replace Method (Char, Char)

 

Replaces all occurrences of a specified character in this instance with another specified character.

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

member Replace : 
        oldChar:char *
        newChar:char -> StringBuilder

Parameters

oldChar
Type: System.Char

The character to replace.

newChar
Type: System.Char

The character that replaces oldChar.

Return Value

Type: System.Text.StringBuilder

A reference to this instance with oldChar replaced by newChar.

This method performs an ordinal, case-sensitive comparison to identify occurrences of oldChar in the current instance. The size of the current StringBuilder instance is unchanged after the replacement.

The following example demonstrates the Replace method.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2016 Microsoft