how to check if char is in string c++ and location code example
Example 1: how to check string contains char in c++
std::string s = "Hello";
if (s.find('e') != std::string::npos)
cout << "Found";
else
cout << "Not Found";
Example 2: check if char in string c++
std::string s = "hell[o";
if (s.find('[') != std::string::npos)
; // found
else
; //