How to count the number of “_” in a string like “bla_bla_blabla_bla”?
#include
std::string s = "a_b_c ";
size_t n = std::count(s.begin(), s.end(),'_');
How to calculate like ” The number of “_” in a string like bla_bla_blabla_bla”?
#include
std::string s = "a_b_c";
size_t n = std:: count(s.begin(), s.end(),'_');