@Ends (JavaScript)

ストリングの最後に特定のサブストリングが指定されているかどうかを確認します。

定義場所

@Functions (JavaScript)

構文

@Ends(value:string,subString:string) : int
パラメータ 説明
value 確認するストリング。
subString サブストリング。
戻り値 説明
int true の場合は 1、false の場合は 0 が設定されます。

使用法

この関数は大文字と小文字を区別します。

以下の例では、「.」または「e」で終わるサブストリングが確認されます。
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var s1 = "Now is the time.";
var s2 = ".";

if(@Ends(s1, s2) == @True()) // returns 1
	p("String s1 ends with " + s2);
else
	p("String s1 does not end with " + s2);

s2 = "e";

if(@Ends(s1, s2) == @True()) // returns 0
	p("String s1 ends with " + s2);
else
	p("String s1 does not end with " + s2);