c++ check if something is in string code example
Example 1: check if character in string c++
std::string s = "hell[o";
if (s.find('[') != std::string::npos)
; // found
else
; //
Example 2: c++ contains
if (s1.find(s2) != std::string::npos) {
std::cout << "found!" << '\n';
}
Example 3: find in string c++
size_t find (const string& str, size_t pos = 0) const;