C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String Insert()The C# Insert() method is used to insert the specified string at specified index number. The index number starts from 0. After inserting the specified string, it returns a new modified string. Signaturepublic string Insert(Int32 first, String second) Parametersfirst: It is used to pass as an index. second: It is used to insert the given string at specified index. ReturnIt returns a new modified string. C# String Insert() Method Example
using System;
public class StringExample
{
public static void Main(string[] args)
{
string s1 = "Hello C#";
string s2 = s1.Insert(5,"-");
Console.WriteLine(s2);
}
}
Output: Hello- C#
Next TopicC# String Intern(String str)
|