计算字符数量:
计算字符数量这个很简单,网上也有很多方法,这里只是简单记录
方法:
int markNumber = count(str.begin(), str.end(), ‘_‘);
替换某个字符:
方法:
string str="ABCDEAAA";
string underLine="A";
string replaceCharacter="Q";
int pos = -1;
pos = str.find(underLine);
while (-1 != pos)
{
str.replace(pos, string(underLine).length(), replaceCharacter);
pos = str.find(underLine);
}
原文:https://www.cnblogs.com/xubaonxopen/p/14072425.html