查找字符串中指定字符的个数
查找字符串中指定字符的个数,
java查找字符串中指定字符个数
查询输入的字符串中各个字符的个数
java字符串获取某字符个数
java统计一个字符串中某个字符串出现的个数
java查找字符串中重复字符
java查找字符串里与指定字符串相同的个数
java查找指定字符出现的次数
如何查找字符串中不同字符的数量
查找字符串中的包含子字符串的个数实现代码
public static int getFindNumber(String str, String findStr) {
int index = 0;
int has = 0;
while ((index = str.indexOf(findStr, index)) != -1) {
has++;
index++;
}
return has;
}
public static void main(String[] args) {
System.out.println(getFindNumber("11a1sdfa", "a"));
}
输出:2


浙公网安备 33010602011771号