Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Inserting string in a String Builder at mid position in C#

  1. using System;
  2. using System.Text;
  3.  
  4. namespace forgetCode
  5. {
  6. class program
  7. {
  8. public static void Main()
  9. {
  10.  
  11. StringBuilder sb1 = new StringBuilder("Time is gold");
  12.  
  13. sb1.Insert(8, "nice and it is ");
  14.  
  15. Console.WriteLine(sb1);
  16. }
  17. }
  18. }


Output:
Time is nice and it is gold