「Google Apps Script」endsWithメソッドで文字の終わりを判定するサンプル
構文
対象文字列.endsWith(検索する文字列)
文字列が指定した引数で終わっていればtrueを返します。それ以外の場合はfalseを返します。
使用例
function myFunction() {
const strA = "study";
if (strA.endsWith("dy")) {
console.log("YES");
} else {
console.log("NO");
}
}
実行結果
YES