C#StringInsert

Returns a new string with a specified string inserted at a specified position.

Syntax

str.Insert(startIndex, value)

Example

Enter values below to update the example in real time.

string
result
Console
WriteLine
string text = "Hello World";
string result = text.Insert(5, ",");
Console.WriteLine(result);   // "Hello, World"