c sharp StringBuilder.Replace methods of Char Char Int32 Int32

  • 2020-05-05 11:48:56
  • OfStack

Replaces all matches of the specified character in the substring of this instance with other specified characters.  

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

Grammar  
C#  
public   StringBuilder   Replace   (  
char   oldChar,  
char   newChar,  
int   startIndex,  
int   count  
)  
Parameter  
oldChar  
The character to be replaced.  

newChar  
Replace the characters of   oldChar  .  

startIndex  
The position at which the instance neutron string begins.  

count  
The length of the substring.  

Returns the value  
A reference to this example, where   oldChar   in the range   startIndex   to   startIndex   +   count     is replaced by   newChar  .  
Abnormal  
Exception type   condition  
ArgumentOutOfRangeException  
startIndex+count   is greater than the length of this instance value.  

-  or  - 

startIndex   or   count   is less than zero.  


Note  
StringBuilder   has the same size because it is just a substitution character. This method is case sensitive.  

Platform  
Windows   98, Windows   2000   SP4, Windows   CE, Windows     Edition Windows   Mobile       PC Windows   Server   2003, Windows   XP   Media   Edition
Windows   XP Professional x64   Edition
.NET   Framework   is not supported for all versions of every platform. For a list of supported versions, see system requirements.


Version information  
.NET   Framework  
Supported by the following versions: 2.0, 1.1, 1.0  

Related articles: