Your Turn: Exact Match vs Found in String
Sometimes a project has to make the distinction between an exact match and the presence or absence of a term in a string. Even if () find index of () returns 0, that doesn’t prove that there aren’t more characters following the match. One way to solve this is to use the is equal to = operator to check if the string is an exact match. If it isn’t, then use the () find index of () block to check if the substring is anywhere in the string.
Example project: comp_find_check_your_turn
- Enter and name comp_find_check_your_turn.
- Click the Download button.
- Check the results in the serial terminal.
- Try entering each of these inputs:
run
I like to run
I like to walk - Verify that the project can recognize the difference between these three inputs.