C#文字列Insert

指定した位置に文字列を挿入します。

構文

str.Insert(startIndex, value)

使用例

下記の値を入力するとサンプルに即時反映されます。

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