ストリングがサブストリングで終わるかどうかを検査します。
| パラメータ | 説明 |
|---|---|
| str | サブストリング。 |
| 戻り値 | 説明 |
|---|---|
| boolean | このストリングがサブストリングで終わる場合、またはサブストリングが空の場合は true。 |
var cities = new String("Paris Moscow Tokyo");
if (cities.endsWith("Tokyo"))
return "Ends with Tokyo";
else
return "Does not end with Tokyo"
cities = new String("Paris Moscow Tokyo");
if (cities.endsWith("TOKYO"))
return "Ends with TOKYO";
else
return "Does not end with TOKYO"