File tree 1 file changed +4
-4
lines changed
build/shared/examples/08.Strings/StringIndexOf
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -43,22 +43,22 @@ void loop() {
43
43
44
44
stringOne = " <UL><LI>item<LI>item<LI>item</UL>" ;
45
45
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 );
48
48
49
49
// lastIndexOf() gives you the last occurrence of a character or string:
50
50
int lastOpeningBracket = stringOne.lastIndexOf (' <' );
51
51
Serial.println (" The index of the last < in the string " + stringOne + " is " + lastOpeningBracket);
52
52
53
53
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);
55
55
56
56
57
57
// lastIndexOf() can also search for a string:
58
58
stringOne = " <p>Lorem ipsum dolor sit amet</p><p>Ipsem</p><p>Quod</p>" ;
59
59
int lastParagraph = stringOne.lastIndexOf (" <p" );
60
60
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);
62
62
63
63
// do nothing while true:
64
64
while (true );
You can’t perform that action at this time.
0 commit comments