How can I detect if a string contains a certain word? For example, I have a string below which reads:
@\"Here is my string.\"
I\'d like to know
A complete solution would first scan for the string (without added blanks), then check if the immediately prior character is either blank or beginning of line. Similarly check if the immediately following character is either blank or end of line. If both tests pass then you have a match. Depending on your needs you might also check for ,
, .
, ()
, etc.
An alternative approach, of course, is to parse the string into words and check each word individually.