remove (JavaScript)

サブストリングを削除します。

定義場所

String (Standard - JavaScript)

構文

remove(index:int) : string

remove(index:int, count:int) : string

パラメータ 説明
index 削除の開始位置。索引が 0 以下の場合、または最後の索引より大きい場合、削除は行われません。
count 削除する文字数。デフォルトは、サブストリングの終わりです。count が 0 以下の場合、削除は行われません。
戻り値 説明
string サブストリングが削除されたこのストリングのコピー。 このストリングは、そのままの状態で残ります。

(1) この例では、Paris が返されます。
cities = new String("Paris   Moscow   Tokyo");
cities.remove(5)

(2) この例では、新規ストリング Paris Tokyo が作成されます。

cities = new String("Paris   Moscow   Tokyo");
cities.remove(5, 9)