Answers for "how to find all characters in a string c++"

C++
14

count a character in a string c++

count(str.begin(), str.end(), 'e')
Posted by: Guest on June-05-2020
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

Code answers related to "how to find all characters in a string c++"

Browse Popular Code Answers by Language