how to find the place that a character of string has in c++ 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: find character in string c++
auto char_to_find = 'a'
if (str.find(char_to_find) != std::string::npos) {
// character found
}