String

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

String()
charAt()
compareTo()
concat()
endsWith()
equals()
equalsIgnoreCase()
getBytes()
indexOf()
lastIndexOf()
length()
replace()
reserve()
setCharAt()
startsWith()
substring()
toCharArray()
toInt()
toLowerCase()
toUpperCase()
trim()

Operators

[] (element access)
+ (concatenation)
== (comparison)

Example

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

See also

string: character arrays
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.