## Reference.StringObject History

January 15, 2015, at 12:07 PM by Arturo -
* [[c_str| c_str]]()
November 16, 2014, at 11:53 AM by Arturo -
Changed line 13 from:
to:
* [[StringAppend | += (append)]]
November 16, 2014, at 11:40 AM by Arturo -
* [[Tutorial/StringRemove]]
November 16, 2014, at 10:25 AM by Arturo -
* [[StringRemove | remove]]()
Changed lines 56-57 from:
* [[StringRemove | remove]]()
to:
November 14, 2014, at 02:11 PM by Arturo -
November 14, 2014, at 01:26 PM by Arturo -
Changed lines 61-65 from:
* [[StringGT| > (greater than)]]()
* [[StringGE| >= (greater than or equal to)]]()
* [[StringLT| < (less than)]]()
* [[StringLE| <= (less than or equal to)]]()
* [[StringDF| != (different from)]]()
to:
* [[StringGT| > (greater than)]]
* [[StringGE| >= (greater than or equal to)]]
* [[StringLT| < (less than)]]
* [[StringLE| <= (less than or equal to)]]
* [[StringDF| != (different from)]]
November 14, 2014, at 01:26 PM by Arturo -
Changed line 51 from:
*[[StringToFloat | toFloat()]]
to:
* [[StringToFloat | toFloat()]]
Changed lines 56-61 from:
* [[StringGT| operator>]]()
* [[StringGE| operator>=]]()
* [[StringLT| operator<]]()
* [[StringLE| operator<=]]()
* [[StringDF| operator!=]]()
to:
* [[StringGT| > (greater than)]]()
* [[StringGE| >= (greater than or equal to)]]()
* [[StringLT| < (less than)]]()
* [[StringLE| <= (less than or equal to)]]()
* [[StringDF| != (different from)]]()
November 10, 2014, at 12:16 PM by Arturo -
Changed line 51 from:
*[[StringToInt | toFloat()]]
to:
*[[StringToFloat | toFloat()]]
November 10, 2014, at 12:10 PM by Arturo -
Changed lines 55-61 from:
to:
* [[StringRemove | remove]]()
* [[StringGT| operator>]]()
* [[StringGE| operator>=]]()
* [[StringLT| operator<]]()
* [[StringLE| operator<=]]()
* [[StringDF| operator!=]]()
November 10, 2014, at 10:36 AM by Arturo -
*[[StringToInt | toFloat()]]
November 13, 2013, at 01:48 PM by Scott Fitzgerald -
Changed lines 2-4 from:
to:

(:cell width=67%:)
!!!!Examples
* [[Tutorial/StringConstructors]]
* [[Tutorial/StringIndexOf]]
* [[Tutorial/StringAppendOperator]]
* [[Tutorial/StringLengthTrim]]
* [[Tutorial/StringCaseChanges]]
* [[Tutorial/StringReplace]]
* [[Tutorial/StringCharacters]]
* [[Tutorial/StringStartsWithEndsWith]]
* [[Tutorial/StringComparisonOperators]]
* [[Tutorial/StringSubstring]]

* [[string]]: character arrays
* [[http://arduino.cc/en/Reference/VariableDeclaration|Variable Declaration]]

(:cell width=33%:)

Changed lines 59-76 from:

!!!!Examples
* [[Tutorial/StringConstructors]]
* [[Tutorial/StringIndexOf]]
* [[Tutorial/StringAppendOperator]]
* [[Tutorial/StringLengthTrim]]
* [[Tutorial/StringCaseChanges]]
* [[Tutorial/StringReplace]]
* [[Tutorial/StringCharacters]]
* [[Tutorial/StringStartsWithEndsWith]]
* [[Tutorial/StringComparisonOperators]]
* [[Tutorial/StringSubstring]]

* [[string]]: character arrays
* [[http://arduino.cc/en/Reference/VariableDeclaration|Variable Declaration]]
to:
(:tableend:)
November 13, 2013, at 01:41 PM by Scott Fitzgerald -
* [[StringReserve | reserve]]()
Deleted line 53:
April 10, 2013, at 11:33 AM by Federico -
* [[StringToInt | toInt()]]
August 15, 2010, at 08:49 PM by Tom Igoe -
August 13, 2010, at 11:46 PM by David A. Mellis -
Changed lines 5-8 from:
The String library, part of the core as of version 0019, allows you to use and manipulate strings of text in more complex ways than the [[string|string character array]] does. 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, constant character arrays are referred to as strings with a small s, and String objects are referred to as Strings with a capital S.
to:
The String class, part of the core as of version 0019, allows you to use and manipulate strings of text in more complex ways than [[string| 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
* [[StringConstructor | String]]()
* [[StringCharAt | charAt]]()
* [[StringCompareTo | compareTo]]()
* [[StringConcat | concat]]()
* [[StringEndsWith | endsWith]]()
* [[StringEquals | equals]]()
* [[StringEqualsIgnoreCase | equalsIgnoreCase]]()
* [[StringGetBytes | getBytes]]()
* [[StringIndexOf | indexOf]]()
* [[StringLastIndexOf | lastIndexOf]]()
* [[StringLength | length]]()
* [[StringReplace | replace]]()
* [[StringSetCharAt | setCharAt]]()
* [[StringStartsWith | startsWith]]()
* [[StringSubstring | substring]]()
* [[StringToCharArray | toCharArray]]()
* [[StringToLowerCase | toLowerCase]]()
* [[StringToUpperCase | toUpperCase]]()
* [[StringTrim | trim]]()

!!!!Operators
* [[StringBrackets | [] (element access)]]
* [[StringPlus | + (concatenation)]]
* [[StringComparison | == (comparison)]]
Deleted lines 35-80:
All of the following are valid declarations for Strings.
[@
String stringOne = "Hello String"; // using a constant String
String stringOne = String('a'); // converting a constant char into a String
String stringTwo = String("This is a string"); // converting a constant string into a String object
String stringOne = String(stringTwo + " with more"); // concatenating two strings
String stringOne = String(13); // using a constant integer
String stringOne = String(analogRead(0), DEC); // using an int and a base
String stringOne = String(45, HEX); // using an int and a base (hexadecimal)
String stringOne = String(255, BIN); // using an int and a base (binary)
String stringOne = String(millis(), DEC); // using a long and a base
@]

'''Possible ways to declare strings'''

* use a constant string of characters, in double quotes
* use a single constant character, in single quotes
* Cast a constant string of characters into a String object
* Concatenating two String objects, or a String object and a constant string of characters.
* use a constant integer. The integer will be cast into the character array that represents it. See below for details
* use a constant integer and a base value. The integer will be cast into a character array that represents in the base. See below for details.
* use a constant long integer, or a variable integer or long integer. Works the same way as using a constant integer or long integer.

'''Constant integer Strings'''

Declaring a String with a constant number results in a string that contains the ASCII representation of that number. The default is base ten,so

@@String thisString = String(13)@@

gives you the String "13". You can use other bases, however. For example,

@@String thisString = String(13, HEX)@@

gives you the String "D", which is the hexadecimal representation of the decimal value 13. Or if you prefer binary,

@@String thisString = String(13, BIN)@@

gives you the String "1011", which is the binary representation of 13.

Experienced programmers may be wondering how to declare a String of a fixed length of 13 characters. There's no constructor for that, because Strings can be added to through concatenation, or shortened through using @@trim()@@.

*[[string]] simple character arrays holding text strings
* [[http://arduino.cc/en/Reference/VariableDeclaration|Variable Declaration]]
''Examples:''

* [[string]]: character arrays
* [[http://arduino.cc/en/Reference/VariableDeclaration|Variable Declaration]]
August 13, 2010, at 11:29 PM by Tom Igoe -
!!String

!!!!Description

The String library, part of the core as of version 0019, allows you to use and manipulate strings of text in more complex ways than the [[string|string character array]] does. 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, constant character arrays are referred to as strings with a small s, and String objects are referred to as Strings with a capital S.

!!!!Examples
All of the following are valid declarations for Strings.
[@
String stringOne = "Hello String"; // using a constant String
String stringOne = String('a'); // converting a constant char into a String
String stringTwo = String("This is a string"); // converting a constant string into a String object
String stringOne = String(stringTwo + " with more"); // concatenating two strings
String stringOne = String(13); // using a constant integer
String stringOne = String(analogRead(0), DEC); // using an int and a base
String stringOne = String(45, HEX); // using an int and a base (hexadecimal)
String stringOne = String(255, BIN); // using an int and a base (binary)
String stringOne = String(millis(), DEC); // using a long and a base
@]

'''Possible ways to declare strings'''

* use a constant string of characters, in double quotes
* use a single constant character, in single quotes
* Cast a constant string of characters into a String object
* Concatenating two String objects, or a String object and a constant string of characters.
* use a constant integer. The integer will be cast into the character array that represents it. See below for details
* use a constant integer and a base value. The integer will be cast into a character array that represents in the base. See below for details.
* use a constant long integer, or a variable integer or long integer. Works the same way as using a constant integer or long integer.

'''Constant integer Strings'''

Declaring a String with a constant number results in a string that contains the ASCII representation of that number. The default is base ten,so

@@String thisString = String(13)@@

gives you the String "13". You can use other bases, however. For example,

@@String thisString = String(13, HEX)@@

gives you the String "D", which is the hexadecimal representation of the decimal value 13. Or if you prefer binary,

@@String thisString = String(13, BIN)@@

gives you the String "1011", which is the binary representation of 13.

Experienced programmers may be wondering how to declare a String of a fixed length of 13 characters. There's no constructor for that, because Strings can be added to through concatenation, or shortened through using @@trim()@@.

*[[string]] simple character arrays holding text strings
* [[http://arduino.cc/en/Reference/VariableDeclaration|Variable Declaration]]
''Examples:''
* [[Tutorial/StringConstructors]]