如何计算像“bla_bla_blabla_bla”这样的字符串中的“_”数? #include algorithmstd::string s = "a_b_c";size_t n = std::count(s.begin(), s.end(), '_');
#include <algorithm> std::string s = "a_b_c"; size_t n = std::count(s.begin(), s.end(), '_');
#include <algorithm> std::string s = "a_b_c"; size_t n = std::count(s.begin(), s.end(), '_');