String.Insertメソッドは文字列に別の文字列を挿入するメソッドです。 Insertメソッドは別の文字列を挿入した結果を返します。
String.Insertメソッドを使って文字列に別の文字列を挿入する
Imports System
Class Sample
Shared Sub Main()
Dim s As String = "The quick brown fox jumps over the lazy dog"
Console.WriteLine(s)
Console.WriteLine(s.Insert(40, "white ")) ' 40文字目に"white "を挿入
End Sub
End Class
実行結果
The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy white dog
このメソッドでは、元の文字列には変更を加えず、挿入した結果を新しい文字列として返します。