#include <algorithm>
std::string s = "a_b_c";
std::string::difference_type n = std::count(s.begin(), s.end(), '_');
More Related Contents:
- how to check if given c++ string or char* contains only digits?
- What is the most efficient C++ method to split a string based on a particular delimiter similar to split method in python? [closed]
- Why when i add number to string it shows random text in c++?
- How do I iterate over cin line by line in C++?
- Converting std::__cxx11::string to std::string
- Is a string literal in С++ created in static memory?
- What’s the rationale for null terminated strings?
- Sizeof string literal
- How to compare multiple strings inside an if statement?
- How to implode a vector of strings into a string (the elegant way)
- Fast String Hashing Algorithm with low collision rates with 32 bit integer [closed]
- Why can’t I write to a string literal while I *can* write to a string object?
- How to get the number of characters in a std::string?
- Difference between and ?
- Deprecated conversion from string literal to ‘char*’
- How to convert UTF-8 std::string to UTF-16 std::wstring?
- How do I replace all instances of a string with another string?
- C++ convert integer to string at compile time
- sizeof in c++ showing string size one less
- Why does calling std::string.c_str() on a function that returns a string not work?
- variable or field declared void
- How can I make the map::find operation case insensitive?
- equivalent of Console.ReadLine() in c++
- How to write an object to file in C++
- Memory-efficient C++ strings (interning, ropes, copy-on-write, etc) [closed]
- converting narrow string to wide string
- convert string to integer in c++
- How to convert int to string in C++
- What’s the difference between istringstream, ostringstream and stringstream? / Why not use stringstream in every case?
- Assign a string literal to a char* [duplicate]