Loading...

Tutorial.StringStartsWithEndsWith History

Show minor edits - Show changes to markup

May 02, 2012, at 10:00 AM 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 09:59 AM 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 09:58 AM by Scott Fitzgerald -
Changed line 32 from:

(:sourceend:)

to:

(:sourceend:)(:divend:)

Added line 34:

(:div class=code :)

May 02, 2012, at 09:54 AM by Scott Fitzgerald -
Changed line 46 from:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)

to:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/08.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)

November 15, 2011, at 10:22 PM by Scott Fitzgerald -
Changed line 46 from:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)

to:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)

September 19, 2010, at 05:56 PM by Christian Cerrito -
Added lines 21-23:

Code

Deleted line 43:

Code

September 19, 2010, at 05:54 PM by Christian Cerrito -
Changed lines 5-6 from:

The 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 substring.

to:

The 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 substring.

Added lines 61-62:
September 19, 2010, at 05: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.

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

(:divend:)

Deleted lines 40-45:

Circuit

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

September 16, 2010, at 04: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 04: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://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino  tabwidth=4:)
to:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)

August 01, 2010, at 12:02 PM by Tom Igoe -
Changed lines 5-6 from:

The 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 @@substring.

to:

The 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 substring.

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

String Character Functions

to:

String startsWith and endsWith Functions

August 01, 2010, at 11:37 AM by Tom Igoe -
Added lines 1-60:

Examples > Strings

String Character Functions

The 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 @@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




Bookmark and Share