Methods
StringBuilder.Append :
Append information to the end of the current StringBuilder.
StringBuilder.AppendFormat :
Replace a formate specifier passed in a string with formatted text.
StringBuilder.Insert :
Inserts a string or object into the specified index of the current.
StringBuilder.Remove :
Remove a specified number of a characters from the current StringBuilder.
StringBuilder.Replace :
Replace a specified character at a specified index.
A simple program using String Builder class :
using System;
using System.Text;
class StringDemo {
public static void Main () {
string str ="www.Scanftree.com";
StringBuilder revStr=new StringBuilder();
for (int count=str.Length-1;count>-1 count--) {
revStr.Append(str[count]);
}
Console.WriteLine(revStr.ToString());
Console.ReadLine();
}
}
using System;
using System.Text;
class StringBuilderDemo1 {
public static void Main() {
StringBuilder myStringBuilder=new StringBuilder();
myStringBuilder.Append("myString");
myStringBuilder.Append("here is another String ", 0,4);
Console.WriteLine(myStringBuilder);
Console.ReadLine();
}
}
