Answers for "count occurrences of character in string c++"

C++
6

count a character in a string c++

count(str.begin(), str.end(), 'e')
Posted by: Guest on June-05-2020
1

count occurrences of character in string c++

std::string s = "a_b_c";
size_t n = std::count(s.begin(), s.end(), '_'); // n=2
Posted by: Guest on September-14-2020
1

string count occurrences c++

#include <algorithm>

std::string s = "a_b_c";
size_t n = std::count(s.begin(), s.end(), '_'); //n=2
Posted by: Guest on April-18-2021

Code answers related to "count occurrences of character in string c++"

Browse Popular Code Answers by Language