int main () { int found = text.find("some text"); if (found != std::string::npos) { //do stuff if word is there } else { //do stuff when word isnt there } }