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.