1 String text = "你好,,.。wo"; 2 String Reg="^[\u4e00-\u9fa5]{1}$";//正则 3 int result=0; 4 for(int i=0;i<text.length();i++){ 5 String b=Character.toString(text.charAt(i)); 6 if(b.matches(Reg)) 7 result++; 8 } 9 }
原文地址:https://www.cnblogs.com/flyinghome/p/12144630.html
时间: 2024-10-13 13:17:08