toInt()
描述
把字串轉換成一個整數。輸入的字串應該要以整數數字開頭,假如字串中包含非整數的數字,這個函式即停止轉換。
語法
string.toInt()
參數
string
: String 物件 (字串)
回傳
long 型別 (假如這個字串是因為開頭不是整數數字而不能被轉換,則回傳 0)
範例
See also
- String
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.