1、count_if
检测字符串中符合条件的字符的个数。

eg:检测字符串str中是否有非数字部分。

bool IsNum(char ch){
return !isdigit(ch);
}

int count = count_if(str.begin(),str.end(), IsNum);

2、计算字符串str中的和,并且对结果进行范围检测。

stoi(str)<=1000&&stoi(str)>=1