java如何判断一个字符串中某个字符有几个
判断长度
"abc".length()
判断某个字du符有zhidao几个
String a = "abbdfsads";
int n = a.length()-a.replaceAll("a", "").length();
System.out.println("字符串中zhuan字符a有"+n+"个");
判断长度
"abc".length()
判断某个字du符有zhidao几个
String a = "abbdfsads";
int n = a.length()-a.replaceAll("a", "").length();
System.out.println("字符串中zhuan字符a有"+n+"个");