lastIndexOf lastIndexOf

2 番目のパラメータが最後に現れる(最初の引数内の)位置を返します。一致するものがない場合は -1 を返します。

カテゴリ

文字列

関数の構文

lastIndexOf(<parameters>)

パラメーター

パラメーター
タイプ
string
String
指定値
文字列

シグネチャと戻り値のタイプ

lastIndexOf(<string>,<string>)

整数を返します。

lastIndexOf("Hello, "l")

3 を返します。

説明:

「Hello」で「l」が最後に出現するのは位置 3 です。

recommendation-more-help
b22c9c5d-9208-48f4-b874-1cefb8df4d76