Pot.Text.startsWith

{Boolean} Pot.Text.startsWith ({String} string, {String} prefix [, {Boolean} ignoreCase = false])

Pot.js で利用可能。 PotLite.js では利用できません。

文字列 string の先頭が prefix かどうか調べます。

引数 string は、対象の文字列を指定します。
引数 prefix は、調べる文字列を指定します。
string の先頭が prefix の場合、 true が返ります。
そうでない場合、false が返ります。
引数 ignoreCase を 真 (true) として指定すると、大文字小文字を区別しないで調べます。

Pot.globalize() が適応されている場合、Pot.startsWith() が startsWith() で実行できます。

string の先頭が prefix なら true が返ります。そうでない場合 false が返ります。

var result = Pot.startsWith('foo bar baz', 'foo');
debug(result); // true
var result = Pot.startsWith('bar foo foo bar baz foo', 'foo');
debug(result); // false
var result = Pot.startsWith('FoO bar foo foo bar baz foo', 'foo', true);
debug(result); // true