[Data Types]
描述
The String class allows you to use and manipulate strings of text in more complex ways than character arrays do. You can concatenate Strings, append to them, search for and replace substrings, and more. It takes more memory than a simple character array, but it is also more useful.
For reference, character arrays are referred to as strings with a small s, and instances of the String class are referred to as Strings with a capital S. Note that constant strings, specified in “double quotes” are treated as char arrays, not instances of the String class.
Functions
- [程式語法] String()
- [程式語法] charAt()
- [程式語法] compareTo()
- [程式語法] concat()
- [程式語法] endsWith()
- [程式語法] equals()
- [程式語法] equalsIgnoreCase()
- [程式語法] getBytes()
- [程式語法] indexOf()
- [程式語法] lastIndexOf()
- [程式語法] length()
- [程式語法] replace()
- [程式語法] reserve()
- [程式語法] setCharAt()
- [程式語法] startsWith()
- [程式語法] substring()
- [程式語法] toCharArray()
- [程式語法] toInt()
- [程式語法] toLowerCase()
- [程式語法] toUpperCase()
- [程式語法] trim()
Operators
範例
The following are examples of the String
class from the Arduino Tutorial that can work on the 86Duino boards:
- [程式語法] StringConstructors
- [程式語法] StringAdditionOperator
- [程式語法] StringIndexOf
- [程式語法] StringAppendOperator
- [程式語法] StringLengthTrim
- [程式語法] StringCaseChanges
- [程式語法] StringReplace
- [程式語法] StringCharacters
- [程式語法] StringStartsWithEndsWith
- [程式語法] StringComparisonOperators
- [程式語法] StringSubstring
參考
- [程式語法] string: character arrays
- [程式語法] Variable Declaration
語法參考主頁面
86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。