@Begins (JavaScript)

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

定義場所

@Functions (JavaScript)

構文

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

使用法

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

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

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

if(@Begins(s1, s2) == @True()) // returns 1
	p("String s1 begins with " + s2);
else
	p("String s1 does not begin with " + s2);

s2 = "n";

if(@Begins(s1, s2) == @True()) // returns 0
	p("String s1 begins with " + s2);
else
	p("String s1 does not begin with " + s2);