Skip to content
Advertisement

Tag: string-matching

Java – Check if any of the words is contained in the text

I was trying to implement a method which checks whether a list of words is contained in a text. The problem is I cannot use the contains method because I just want the word to be detected (if the word is ‘car’ then with the string ‘cars’ the method should return false). In addition, the method should be case-sensitive. EDIT:

Advertisement