标签:
public class TotalUtil {
public static int getSum(String text) {
String reg = "^[\u4e00-\u9fa5]{1}$";
int result = 0;
for (int i = 0; i < text.length(); i++) {
String b = Character.toString(text.charAt(i));
if (b.matches(reg)) {
result++;
}
}
return result;
}
}
标签:
原文地址:http://www.cnblogs.com/mayi1/p/5519570.html