Skip to content

Commit 47bcf07

Browse files
committed
fix StringIndexOf example logic and wording
1 parent c5824fd commit 47bcf07

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

build/shared/examples/08.Strings/StringIndexOf/StringIndexOf.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ void loop() {
4343

4444
stringOne = "<UL><LI>item<LI>item<LI>item</UL>";
4545
int firstListItem = stringOne.indexOf("<LI>");
46-
int secondListItem = stringOne.indexOf("item", firstListItem + 1);
47-
Serial.println("The index of the second list item in the string " + stringOne + " is " + secondClosingBracket);
46+
int secondListItem = stringOne.indexOf("<LI>", firstListItem + 1);
47+
Serial.println("The index of the second list tag in the string " + stringOne + " is " + secondListItem);
4848

4949
// lastIndexOf() gives you the last occurrence of a character or string:
5050
int lastOpeningBracket = stringOne.lastIndexOf('<');
5151
Serial.println("The index of the last < in the string " + stringOne + " is " + lastOpeningBracket);
5252

5353
int lastListItem = stringOne.lastIndexOf("<LI>");
54-
Serial.println("The index of the last list item in the string " + stringOne + " is " + lastListItem);
54+
Serial.println("The index of the last list tag in the string " + stringOne + " is " + lastListItem);
5555

5656

5757
// lastIndexOf() can also search for a string:
5858
stringOne = "<p>Lorem ipsum dolor sit amet</p><p>Ipsem</p><p>Quod</p>";
5959
int lastParagraph = stringOne.lastIndexOf("<p");
6060
int secondLastGraf = stringOne.lastIndexOf("<p", lastParagraph - 1);
61-
Serial.println("The index of the second last paragraph tag " + stringOne + " is " + secondLastGraf);
61+
Serial.println("The index of the second to last paragraph tag " + stringOne + " is " + secondLastGraf);
6262

6363
// do nothing while true:
6464
while (true);

0 commit comments

Comments
 (0)