startsWith()

描述

测试字串是否以指定的字元 (或字串) 做为开头。

语法


string.startsWith(string2)

参数

string : String 物件 (字串)
string2 : 另一个 String 物件 (字串)

回传

true: 假如 string 是以 string2 为开头
false: 与上面相反

范例

StringStartsWithEndsWith

See also

String
endsWith()


Language Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.