Answers for "how to check if letter is in string in cpp"

C++
9

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
0

checking if a string has only letters cpp

#include <regex>

bool contains_non_alpha
    = !std::regex_match(name, std::regex("^[A-Za-z]+$"));
Posted by: Guest on October-19-2021

Code answers related to "how to check if letter is in string in cpp"

Browse Popular Code Answers by Language