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.