How to insert a string using C# ?

By | April 17, 2011

Hi,
Want to know how to insert a string at a particular position in C# ? See the following code.

using System;

class MainClass {
  public static void Main() {
    string testStr= "Coderz Heaven";

    testStr= testStr.Insert(6, "Codes");
    Console.WriteLine(testStr);

  }
}

It will print- “Coderz Codes Heaven”

🙂

Leave a Reply

Your email address will not be published. Required fields are marked *