how to check substring is present in string in c++ code example
Example 1: c++ check substring
if (s1.find(s2) != std::string::npos) {
std::cout << "found!" << '\n';
}
Example 2: check if character in string c++
std::string s = "hell[o";
if (s.find('[') != std::string::npos)
; // found
else
; //