private static int getCount(String str,String subStr){
int result=0;
while(str.contains(subStr)){
str = str.substring(str.indexOf(subStr)+subStr.length(),str.length());
result += 1;
}
return result;
}
Determine the number of times a character appears in a whole string
Guess you like
Origin www.cnblogs.com/topadu/p/11119554.html
Recommended
Ranking