Answers for "check that a char is found only once in a string cpp"

C++
3

find character in string c++

auto char_to_find = 'a'
if (str.find(char_to_find) != std::string::npos) {
    // character found
}
Posted by: Guest on September-15-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 "check that a char is found only once in a string cpp"

Browse Popular Code Answers by Language