public class tiqu { public static void main(String args[]) { String str = "tengsir,admin,jack,rose"; int istr = str.length(); String str1 = str.replaceAll("[,]", ""); int istr1 = str1.length(); System.out.println("人名个数是:" + (istr - istr1)); } }