c++ if contains substring code example
Example 1: c++ check substring
if (s1.find(s2) != std::string::npos) {
std::cout << "found!" << '\n';
}
Example 2: c++ string contains
if (string1.find(string2) != std::string::npos) {
std::cout << "found!" << '\n';
}