Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

count occurrences of character in string c++

std::string s = "a_b_c";
size_t n = std::count(s.begin(), s.end(), '_'); // n=2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #count #occurrences #character #string
ADD COMMENT
Topic
Name
1+8 =