Answers for "check a character in a string c++"

C++
5

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";
Posted by: Guest on August-23-2020
3

check if char in string c++

std::string s = "hell[o";
if (s.find('[') != std::string::npos)
    ; // found
else
    ; //
Posted by: Guest on September-14-2020

Code answers related to "check a character in a string c++"

Browse Popular Code Answers by Language