string manipulation using methods of both StringBuilder and String classes

PHOTO EMBED

Sun Oct 12 2025 17:09:03 GMT+0000 (Coordinated Universal Time)

Saved by @final

using System;
using System.Text;
class Program {
    static void Main() {
        string str = "hello";
        Console.WriteLine(str.ToUpper());
        Console.WriteLine(str.Replace('l','x'));
        StringBuilder sb = new StringBuilder(str);
        sb.Append(" world");
        Console.WriteLine(sb.ToString());
        sb.Remove(0,2);
        Console.WriteLine(sb);
        sb.Insert(0, "hi ");
        Console.WriteLine(sb);
    }
}
content_copyCOPY