日期:2014-05-20 浏览次数:20736 次
String s = "aaaabbbsss"; Pattern p = Pattern.compile("[a]{2}"); Matcher m = p.matcher(s); int count = 0; while (m.find()) { count++; } System.out.println(count);