如果想要在一个字符串中找到特定的字符,
并且对该字符进行计数的话.
可以使用下列程序:
比如统计字符串中's'的数目
#include <string>
#include <algorithm>
using namespace std;
void main()
{
string st("st,dsfeapfa,vcca,dfeafsdafsv,");
int nCount = count(st.begin(), st.end(), 's');
printf("%d\n",nCount);
}