Hide minor edits - Show changes to markup
(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.ino lang=arduino tabwidth=4:)
(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/08.Strings/StringAppendOperator/StringAppendOperator.ino lang=arduino tabwidth=4:)
(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde lang=arduino tabwidth=4:)
(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.ino lang=arduino tabwidth=4:)
(:divend:)
(:divend:)
In both cases, stringOne equals "A long integer: 123456789".
(:divend:)
In both cases, stringOne equals "A long integer: 123456789". Like the + operator, these operators are handy for assembling longer strings from a combination of data objects.
(:divend:)
No external hardware is required. (:divend:)
Like the + operator, these operators are handy for assembling longer strings from a combination of data objects.
There is no circuit for this example. (:divend:)
[@
(:source lang=arduino tabwidth=4:)
@]
(:sourceend:)
[@
(:source lang=arduino tabwidth=4:)
@]
(:sourceend:)
(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde lang=arduino tabwidth=4:)
(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde lang=arduino tabwidth=4:)
// using concat() to add a long variable to a string:
// using += to add a long variable to a string:
Examples > Control Structures
Examples > Strings
Like the + operator, this
Like the + operator, these operators are handy for assembling longer strings from a combination of data objects.
Examples > Control Structures
Just as you can concatenate Strings with other data objects using the StringAdditionOperator, you can also use the += operator and the cconcat() method to append things to Strings. The += operator and the concat() method work the same way, it's just a matter of which style you prefer. The two examples below illustrate both, and result in the same String:
(:div class=code :)
String stringOne = "A long integer: "; // using concat() to add a long variable to a string: stringOne += 123456789;
or
String stringOne = "A long integer: "; // using concat() to add a long variable to a string: stringTwo.concat(123456789);
In both cases, stringOne equals "A long integer: 123456789".
(:divend:)
(:div class=BOM :)
No external hardware is required. (:divend:)
Like the + operator, this
(:div class=circuit :) There is no circuit for this example. (:divend:)
(:div class=code :)
(:source