using the StringBuilder methods Replace, Insert, Append, AppendFormat, and Remove:
using System;
using System.Text;
class UseSBApp {
static void Main(string[] args) {
StringBuilder sb = new StringBuilder("Pineapple");
sb.Replace('e', 'X');
sb.Insert(4, "Banana");
sb.Append("Kiwi");
sb.AppendFormat(", {0}:{1}", 123, 45.6789);
sb.Remove(sb.Length - 3, 3);
Console.WriteLine(sb);
}
}
Related examples in the same category