Learn Create Your Own Split Screen

Next Page

Here's something Scratch can't do -- searching inside a string.

For this, we use the indexOf() method (note the small "i" and big "O"), passing in the string we want to look for.

The method returns the position (or "index") of the first appearance, or -1 if not found.

With searching, case matters . If you want to do a case-insigificant search, you need to do something as shown in the final two examples.


Have a close look at the examples and make sure you understand them. Try your own experiments.