The second group of functionalities is related to searching for the string. You can use methods such as startsWith(), endsWith(), and contains() to search for substrings in the beginning or end or in an arbitrary place in the string. The number of occurrences of a substring in the string can be retrieved using the count() method.
If you need to know the exact position of the match, you can use indexOf() or lastIndexOf() to receive the position in the string where the match occurs. The first call works by searching forward, and the other one searches backwards. Each of these calls takes ...