John C. answered 04/21/20
Tutor
4.9
(1,532)
BS and MS in Comp Sci, 34 years experience, 3 yrs CS tutoring
Use the "find" method to perform this function. It returns the position of the string-to-find in the string, and string::npos if it is not found. So the equivalent of "if string found" is "if(myStr.find(searchStr) != string::npos)".