Let's say that I am looking for the word "or"
. What I want is to check whether that word appears as a word or as a substring of another word.
E.g.
Input - "or" Output - "true"
Input - "for" Output - "false"
I suppose I could check if the chars before and after are letters but is there a more efficient/easier way of doing it? Thanks
Edit In addition, the string will be part of a sentence. So I want "I can go shopping or not" to return true but "I can go shopping for shoes" to return false. Therefore using == wouldn't work. I'm sorry I should've mentioned this earlier