Tutorial.StringStartsWithEndsWith History

Hide minor edits - Show changes to output

August 27, 2015, at 01:19 PM by Simone Maiocchi -
Changed lines 1-6 from:
(:div class=breadcrumb:)
[[Tutorial.HomePage | Tutorials]] > [[Tutorial.Examples | Examples]] > Strings > StringStartsWithEndsWith
(:divend:)

(:*toc:)
to:
(:html:)

<div class="subHeader row">

<div class="breadcrumb columns large-10 medium-10">
<p>
<a class="wikilink" href="/en/Tutorial/HomePage">Tutorials </a>
> <a class="wikilink" href="/en/Tutorial/BuiltInExamples"> Built-In Examples </a> > 08.Strings > StringStartsWithEndsWith
</p>
</div>
</div>

(:htmlend:)

Changed lines 63-75 from:
* [[Reference/StringObject|String object]]
* [[StringConstructors]]
* [[StringAdditionOperator]]
* [[StringIndexOf]]
* [[StringAppendOperator]]
* [[StringLengthTrim]]
* [[StringCaseChanges]]
* [[StringReplace]]
* [[StringCharacters]]
* [[StringStartsWithEndsWith]]
* [[StringComparisonOperators]]
* [[StringSubstring]]
to:
* [[Reference/StringObject|String object]] – Your Reference for String objects
* [[CharacterAnalysis]] - We use the operators that allow us to recognise the type of character we are dealing with.
* [[StringAdditionOperator]] - Add strings together in a variety of ways.
* [[StringAppendOperator]] - Use the += operator and the concat() method to append things to Strings
* [[StringCaseChanges]] - Change the case of a string.
* [[StringCharacters]] - Get/set the value of a specific character in a string.
* [[StringComparisonOperators]] - Get/set the value of a specific character in a string.
* [[StringConstructors]] - Initialize string objects.
* [[StringIndexOf]] - Look for the first/last instance of a character in a string.
* [[StringLength]] - Get the length of a string.
* [[StringLengthTrim]] - Get and trim the length of a string.
* [[StringReplace]] - Replace individual characters in a string.
* [[StringSubstring]] - Look for "phrases" within a given string.
* [[StringToInt]] - Allows you to convert a String to an integer number.

August 11, 2015, at 11:13 AM by Simone Maiocchi -
Changed lines 18-19 from:
There is no circuit for this example, though your board must be connected to your computer via USB.
to:
There is no circuit for this example, though your board must be connected to your computer via USB and the serial monitor window of the Arduino Software (IDE) should be open..
Changed lines 67-68 from:
to:
\\
''Last revision 2015/08/11 by SM''
July 10, 2015, at 02:07 PM by Simone Maiocchi -
Changed lines 5-6 from:
(:*toc:)''Examples > Strings''
to:
(:*toc:)
Changed lines 30-31 from:
(:div class=code:)
(:source lang=arduino tabwidth=4:)
to:
[@
Changed lines 35-36 from:
(:sourceend:)
(:divend:)
to:
@]
Changed lines 37-38 from:
(:div class=code:)
(:source lang=arduino tabwidth=4:)
to:
[@
Changed lines 42-45 from:
(:sourceend:)
(:divend:)

to:
@]
Changed line 53 from:
!!!See Also:
to:
!!!See Also
July 10, 2015, at 02:05 PM by Simone Maiocchi -
Changed lines 1-9 from:
''Examples > Strings''

!!!String startsWith and endsWith 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
* Arduino Board
to:
(:div class=breadcrumb:)
[[Tutorial.HomePage | Tutorials]] &gt; [[Tutorial.Examples | Examples]] &gt; Strings &gt; StringStartsWithEndsWith
Added lines 5-15:
(:*toc:)''Examples > Strings''

!!String startsWith and endsWith 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
* Arduino or Genuino Board
(:divend:)
Changed lines 18-19 from:
There is no circuit for this example, though your Arduino must be connected to your computer via USB.
to:
There is no circuit for this example, though your board must be connected to your computer via USB.
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 https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.ino lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/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 https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/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 https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde lang=arduino tabwidth=4:)
to:
(:source https://raw.githubusercontent.com/arduino/Arduino/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