[Data Types]
Description
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
- [Language] String()
- [Language] charAt()
- [Language] compareTo()
- [Language] concat()
- [Language] endsWith()
- [Language] equals()
- [Language] equalsIgnoreCase()
- [Language] getBytes()
- [Language] indexOf()
- [Language] lastIndexOf()
- [Language] length()
- [Language] replace()
- [Language] reserve()
- [Language] setCharAt()
- [Language] startsWith()
- [Language] substring()
- [Language] toCharArray()
- [Language] toInt()
- [Language] toLowerCase()
- [Language] toUpperCase()
- [Language] trim()
Operators
Example
The following are examples of the String
class from the Arduino Tutorial that can work on the 86Duino boards:
- [Language] StringConstructors
- [Language] StringAdditionOperator
- [Language] StringIndexOf
- [Language] StringAppendOperator
- [Language] StringLengthTrim
- [Language] StringCaseChanges
- [Language] StringReplace
- [Language] StringCharacters
- [Language] StringStartsWithEndsWith
- [Language] StringComparisonOperators
- [Language] StringSubstring
See also
- [Language] string: character arrays
- [Language] Variable Declaration
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.