Methods:
Append |
Appends information to the end of the current StringBuilder. |
AppendFormat |
Replaces a format specifier passed in a string with formatted text. |
Insert |
Inserts a string or object into the specified index of the current StringBuilder. |
Remove |
Removes a specified number of characters from the current StringBuilder. |
Replace |
Replaces a specified character at a specified index. |
Example:
private void Example_StringBuilder()
{
StringBuilder String1 = new StringBuilder("beautiful");
StringBuilder String2 = new StringBuilder();
String2 = String1.Append(" Picture");
// value of String2="beautiful Picture"
String2 = String1.Remove(2, 4);
// value of String2="beful Picture"
String2 = String1.Insert(2, "auti");
// value of String2="beautiful Picture"
String2 = String1.Replace("beautiful", "Wonderful");
// value of String2="Wonderful Picture"
}