namespace SubstringExtension
public static class Helper
public static StringBuilder Substring(this StringBuilder stringBuilder, int startIndex, int length)
StringBuilder resultSb = new StringBuilder();
string convertedString = stringBuilder.ToString();
string subString = convertedString.Substring(startIndex, length);
resultSb.Append(subString);
public static string MakeUpper(string entryString)
string resultString = entryString.ToUpper();
public static class Program
static void Main(string[] args)
StringBuilder resultStringBuilder = new StringBuilder();
string helloWorldString = "Hello, world!";
helloWorldString = MakeUpper(helloWorldString);
StringBuilder helloWorldSb = new StringBuilder();
helloWorldSb.Append(helloWorldString);
resultStringBuilder = helloWorldSb.Substring(0, 5);
Console.WriteLine(resultStringBuilder);