Tutorial.StringStartsWithEndsWith History

Hide minor edits - Show changes to output

May 02, 2012, at 04:00 PM by Scott Fitzgerald -
Changed lines 32-33 from:
(:sourceend:)(:divend:)
to:
(:sourceend:)
(:divend:)
Changed lines 36-37 from:
(:source lang=arduino tabwidth=4:) stringOne = "HTTP/1.1 200 OK";
to:
(:source lang=arduino tabwidth=4:)
stringOne = "HTTP/1.1 200 OK";
Changed lines 41-43 from:
(:sourceend:)(:divend:)

to:
(:sourceend:)
(:divend:)

May 02, 2012, at 03:59 PM by Scott Fitzgerald -
Changed line 26 from:
(:div class=code :)
to:
(:div class=code:)
Changed line 34 from:
(:div class=code :)
to:
(:div class=code:)
May 02, 2012, at 03:58 PM by Scott Fitzgerald -
Changed line 32 from:
(:sourceend:)
to:
(:sourceend:)(:divend:)
Added line 34:
(:div class=code :)
May 02, 2012, at 03:54 PM by Scott Fitzgerald -
Changed line 46 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)
November 16, 2011, at 04:22 AM by Scott Fitzgerald -
Changed line 46 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)
September 19, 2010, at 11:56 PM by Christian Cerrito -
Added lines 21-23:

!!!Code
Deleted line 43:
!!!Code
September 19, 2010, at 11:54 PM by Christian Cerrito -
Changed lines 5-6 from:
The [[Reference/StringObject|String]] functions @@startsWith()@@ and @@endsWith()@@ allow you to check what character or substring a given String starts or ends with. They're basically special cases of @@[[StringSubstring|substring]]@@.
to:
The [[Reference/StringObject|'''String''']] functions @@startsWith()@@ and @@endsWith()@@ allow you to check what character or substring a given String starts or ends with. They're basically special cases of @@[[StringSubstring|substring]]@@.
Added lines 61-62:

September 19, 2010, at 11:53 PM by Christian Cerrito -
Changed line 9 from:
No external hardware is required.
to:
* Arduino Board
Added lines 12-20:
!!!Circuit
(:div class=circuit :)
There is no circuit for this example, though your Arduino must be connected to your computer via USB.

%height=250px%[[Attach:Arduino_bb.png | Attach:Arduino_bb.png]]
[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]

(:divend:)
Deleted lines 40-45:
!!!Circuit

(:div class=circuit :)
There is no circuit for this example.
(:divend:)
September 16, 2010, at 10:56 PM by Tom Igoe -
Changed lines 15-16 from:
(:source lang=arduino tabwidth=4:) stringOne = "HTTP/1.1 200 OK";
to:
(:source lang=arduino tabwidth=4:)
stringOne = "HTTP/1.1 200 OK";
September 16, 2010, at 10:55 PM by Tom Igoe -
Changed lines 15-16 from:
[@
stringOne = "HTTP/1.1 200 OK";
to:
(:source lang=arduino tabwidth=4:) stringOne = "HTTP/1.1 200 OK";
Changed lines 19-20 from:
@]
to:
(:sourceend:)
Changed lines 21-22 from:
[@
stringOne = "HTTP/1.1 200 OK";
to:
(:source lang=arduino tabwidth=4:) stringOne = "HTTP/1.1 200 OK";
Changed lines 25-28 from:
@]
(:divend:)

to:
(:sourceend:)(:divend:)

Changed line 40 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)
August 01, 2010, at 06:02 PM by Tom Igoe -
Changed lines 5-6 from:
The [[Reference/StringObject|String]] functions @@startsWith()@@ and @@endsWith()@@ allow you to check what character or substring a given String starts or ends with. They're basically special cases of @@[[StringSubstring|substring]].
to:
The [[Reference/StringObject|String]] functions @@startsWith()@@ and @@endsWith()@@ allow you to check what character or substring a given String starts or ends with. They're basically special cases of @@[[StringSubstring|substring]]@@.
August 01, 2010, at 06:02 PM by Tom Igoe -
Changed lines 3-4 from:
!!!String Character Functions
to:
!!!String startsWith and endsWith Functions
August 01, 2010, at 05:37 PM by Tom Igoe -
Added lines 1-60:
''Examples > Strings''

!!!String Character Functions

The [[Reference/StringObject|String]] functions @@startsWith()@@ and @@endsWith()@@ allow you to check what character or substring a given String starts or ends with. They're basically special cases of @@[[StringSubstring|substring]].

(:div class=BOM :)
!!!Hardware Required
No external hardware is required.
(:divend:)

@@startsWith()@@ and @@endsWith()@@ can be used to look for a particular message header, or for a single character at the end of a String. They can also be used with an offset to look for a substring starting at a particular position. For example:

(:div class=code :)
[@
stringOne = "HTTP/1.1 200 OK";
if (stringOne.startsWith("200 OK", 9)) {
Serial.println("Got an OK from the server");
}
@]

This is functionally the same as this:
[@
stringOne = "HTTP/1.1 200 OK";
if (stringOne.substring(9) == "200 OK") {
Serial.println("Got an OK from the server");
}
@]
(:divend:)


'''Caution:'''
If you look for a position that's outside the range of the string,you'll get unpredictable results. For example, in the example above stringOne.startsWith("200 OK", 16) wouldn't check against the String itself, but whatever is in memory just beyond it. For best results, make sure the index values you use for @@startsWith@@ and @@endsWith@@ are between 0 and the String's @@length()@@.

!!!Circuit

(:div class=circuit :)
There is no circuit for this example.
(:divend:)

!!!Code
(:div class=code :)

(:source

Share