Answers for "c++ count number of occurences of a character"

C++
2

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
3

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

Code answers related to "c++ count number of occurences of a character"

Browse Popular Code Answers by Language