Completion requirements
This chapter accompanies the previous one. Read it for even more info on Strings.
10. Play with indexOf()
Answer:
6
The first occurrence of the string "a" within the method's string is at index 6.
Play with indexOf()
indexOf()
Play with the following to gain insight into indexOf()
.
Try searching for the second occurrence of "ant" in the line. Pay attention to spaces.
Question 10:
What is the index of the empty string "" ?