サブストリングを挿入します。
パラメータ | 説明 |
---|---|
substr | 挿入するサブストリング。 |
index | 挿入箇所の前の索引。 0 以下の値は、ストリングの先頭を意味します。 最後の索引より大きい値は、ストリングの終わりを意味します。 |
count | 挿入するサブストリングの文字数。デフォルトはサブストリング全部です。 |
戻り値 | 説明 |
---|---|
string | サブストリングが挿入されたこのストリングのコピー。 このストリングは、そのままの状態で残ります。 |
var cities = new String("Paris Tokyo");
cities = cities.insert("Moscow ", 8);
return "cities = " + cities.valueOf()
(2) この例でも同じ操作を行います。
var cities = new String("Paris Tokyo");
cities = cities.insert("Moscow Tokyo", 8, 9);
return "cities = " + cities.valueOf()