c++ if substring in string code example
Example 1: c++ contains
if (s1.find(s2) != std::string::npos) {
std::cout << "found!" << '\n';
}
Example 2: find substring in string c++
std::string parentstring = "Hello Agnosticdev, I love Tutorials";
std::string substring = "Agnosticdev";
auto index = parentstring.find(substring);