The fastest way to check if a string contains a particular word or substring is with the help of String. indexOf() method . This method returns the index of the first occurrence of the specified substring inside the calling String object.
The fastest way to check if a string contains a particular word or substring is with the help of String. indexOf() method . This method returns the index of the first occurrence of the specified substring inside the calling String object.