c# example – convert stringbuilder uppercase.
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | class Program { static void Main(string[] args) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); StringBuilder stringb = new StringBuilder(); stringb.Append("Dunlin. "); stringb.Append("Grey Gull. "); stringb.Append("Victoria Crowned Pigeon."); Console.WriteLine("stringbuilder contents: \n" + stringb.ToString()); //this line convert stringbuilder characters to uppercase characters. string s = stringb.ToString().ToUpper(); stringb.Clear(); stringb.Append(s); Console.WriteLine("\nstringbuilder contents uppercase:\n"+ stringb.ToString()); Console.ReadLine(); } } |
Output: