Replace the matching items of all specified characters in the substring of this instance with other specified characters.
Namespace: system. Text
ProgramSet: mscorlib (in mscorlib. dll)
Syntax
C #
Public stringbuilder Replace (
Char oldchar,
Char newchar,
Int startindex,
Int count
)
Parameters
Oldchar
The character to be replaced.
Newchar
Replace the oldchar character.
Startindex
The starting position of the substring in this instance.
Count
The length of the substring.
Return Value
References to this instance, where oldchar from startindex to startindex + count-1 is replaced by newchar.
Exception
Exception type condition
Argumentoutofrangeexception
Startindex + count is longer than the Instance value.
-Or-
Startindex or count is smaller than zero.
Remarks
The size of stringbuilder remains unchanged, because it only replaces characters. This method is case sensitive.
Platform
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition,
Windows Mobile for Pocket PC, Windows Mobile for smartphone,
Windows Server 2003, Windows XP Media Center edition,
Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
. NET Framework does not support all versions of each platform. For a list of supported versions, see system requirements.
Version Information
. NET Framework
Supported by the following versions: 2.0, 1.1, and 1.0