C# String Insert Method Example

In this source code example, we will demonstrate the usage of String.IndexOf() method in C# with an example.

The C# String.Insert() method is used to insert the specified string at the specified index number. The index number starts from 0. After inserting the specified string, it returns a new modified string.

C# String Insert Method Example

The following example demonstrates the use of the String.Insert() method:
using System;

public class StringDemo
    public static void Main(string[] args)
         string s1 = "sourcecodeexamples";
         string s2 = s1.Insert(6,".");
         string s3 = s2.Insert(11,".");




Related C# String Examples


Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course