Tutorial.StringAdditionOperator History

Hide minor edits - Show changes to markup

May 02, 2012, at 04:03 PM by Scott Fitzgerald -
Added line 108:
Changed lines 110-111 from:

Here's a working example of several different concatenation examples:

to:

Here's a working example of several different concatenation examples :

May 02, 2012, at 04:03 PM by Scott Fitzgerald -
Changed line 99 from:
to:
Deleted line 108:
Added line 110:
May 02, 2012, at 04:02 PM by Scott Fitzgerald -
Changed line 74 from:
to:
Changed lines 78-79 from:
to:
Changed line 82 from:
to:
Changed lines 108-109 from:
to:
May 02, 2012, at 04:01 PM by Scott Fitzgerald -
Changed line 110 from:
to:
November 16, 2011, at 04:25 AM by Scott Fitzgerald -
Changed line 110 from:
to:
September 23, 2010, at 10:44 PM by Christian Cerrito -
Changed lines 3-4 from:

String Addition Operator

to:

String Addition Operator

September 19, 2010, at 11:04 PM by Christian Cerrito -
Added lines 127-128:
September 19, 2010, at 10:43 PM by Christian Cerrito -
Changed lines 110-111 from:
to:
September 19, 2010, at 10:43 PM by Christian Cerrito -
Changed lines 93-94 from:

Here's a working example of several different concatenation examples:

to:

Hardware Required:

  • Arduino Board
Deleted line 97:
Changed lines 99-103 from:

There is no circuit for this example.

to:

There is no circuit for this example, though your Arduino must be connected to your computer via USB.

image developed using Fritzing. For more circuit examples, see the Fritzing project page

Changed lines 108-109 from:
to:
September 19, 2010, at 10:22 PM by Christian Cerrito -
Changed lines 5-6 from:

You can add Strings together in a variety of ways. This is called concatenation and it results in the original String being longer by the length of the String or character array with which you concatenate it. The + operator allows you to combine a String with another String, with a constant character array, an ASCII representation of a constant or variable number, or a constant character.

to:

You can add Strings together in a variety of ways. This is called concatenation and it results in the original String being longer by the length of the String or character array with which you concatenate it. The + operator allows you to combine a String with another String, with a constant character array, an ASCII representation of a constant or variable number, or a constant character.

September 19, 2010, at 10:22 PM by Christian Cerrito -
Deleted lines 7-8:

Hardware Required

No external hardware is required.

September 19, 2010, at 10:04 PM by Christian Cerrito -
Changed lines 3-4 from:

String Addition Operator

to:

String Addition Operator

September 17, 2010, at 12:01 AM by Tom Igoe -
September 16, 2010, at 10:28 PM by Tom Igoe -
Changed line 14 from:

[@

to:
Changed line 29 from:
  @]
to:
Changed line 35 from:

[@

to:
Changed line 37 from:

@]

to:
Changed lines 43-45 from:
  stringThree = stringOne + analogRead(0);
to:
Changed line 55 from:
  int sensorValue = analogRead(0); 
to:
  int sensorValue = analogRead(A0); 
Changed lines 65-66 from:

[@

  int sensorValue = analogRead(0); 
to:
Changed line 69 from:

@]

to:
Changed lines 77-80 from:
 
  Serial.println("I want " + analogRead(0) + " donuts");  
to:
Changed lines 84-85 from:

[@

  int sensorValue = analogRead(0); 
to:
Changed line 88 from:

@]

to:
September 16, 2010, at 10:26 PM by Tom Igoe -
September 16, 2010, at 10:25 PM by Tom Igoe -
Changed line 59 from:
to:
September 16, 2010, at 10:22 PM by Tom Igoe -
Changed line 54 from:

[@

to:
Changed line 59 from:

@]

to:
Changed line 106 from:
to:
August 15, 2010, at 03:25 PM by Tom Igoe -
Changed lines 40-41 from:

This is allowable since the @@millis() function returns a long integer, which can be added to a String. You could also do this:

to:

This is allowable since the millis() function returns a long integer, which can be added to a String. You could also do this:

August 01, 2010, at 04:11 PM by Tom Igoe -
August 01, 2010, at 04:10 PM by Tom Igoe -
Changed lines 1-2 from:

Examples > Control Structures

to:

Examples > Strings

August 01, 2010, at 03:35 PM by Tom Igoe -
Changed lines 54-55 from:

[@ int sensorValue = analogRead(0);

   String stringOne = "Sensor value: ";
to:

[@

  int sensorValue = analogRead(0); 
  String stringOne = "Sensor value: ";
Changed lines 65-66 from:

[@ int sensorValue = analogRead(0);

to:

[@

  int sensorValue = analogRead(0); 
Changed line 78 from:
 Serial.println("I want " + analogRead(0) + " donuts");  
to:
  Serial.println("I want " + analogRead(0) + " donuts");  
August 01, 2010, at 03:34 PM by Tom Igoe -
Added line 35:

[@

Added line 37:

@]

Added line 43:

[@

Added line 45:

@]

Changed lines 50-56 from:
to:

Caution: You should be careful about concatenating multiple variable types on the same line, as you may get unexpected results. For example:

Changed lines 54-56 from:
to:
 int sensorValue = analogRead(0); 
   String stringOne = "Sensor value: ";
  String stringThree = stringOne + sensorValue;
  Serial.println(stringThree);  
Added lines 61-107:
August 01, 2010, at 03:09 PM by Tom Igoe -
Deleted lines 51-57:
August 01, 2010, at 02:52 PM by Tom Igoe -
Changed lines 5-6 from:

The String object You can add Strings together in a variety of ways. This is called concatenation and it results in the original String being longer by the length of the String or character array with which you concatenate it. The + operator allows you to combine a String with another String, with a constant character array, an ASCII representation of a constant or variable number, or a constant character.

to:

You can add Strings together in a variety of ways. This is called concatenation and it results in the original String being longer by the length of the String or character array with which you concatenate it. The + operator allows you to combine a String with another String, with a constant character array, an ASCII representation of a constant or variable number, or a constant character.

August 01, 2010, at 02:50 PM by Tom Igoe -
Changed lines 3-4 from:

String Addition Operators

to:

String Addition Operator

August 01, 2010, at 02:49 PM by Tom Igoe -
Changed line 68 from:
to:
August 01, 2010, at 02:49 PM by Tom Igoe -
Added lines 1-78:

Share