You can use the
find functions to find the string you want. Both return a Boolean value indicating the presence of string
Both solve your problem if you just want to know whether or not it contains the searched string . The result can be used in
if without problems.
If not, you need to be more specific in the question and show what you have already done, and point out the problem.
See running on ideone . And at Coding Ground . Also put it on GitHub for future reference .