Skip to main content

Section 7.16 The in and not in operators

The in operator tests if one string is a substring of another:
Note that a string is a substring of itself, and the empty string is a substring of any other string. (Also note that computer scientists like to think about these edge cases quite carefully!)
The not in operator returns the logical opposite result of in.