private static int matching(String value) {
value = value.replace(" ", "")
.replace("#", "")
.replace("——", "")
.replace("_", "");
String regex1 = "[\u4E00-\u9FA5]+";
String regex2 = "^[A-Za-z0-9]+$";
//创建一个字符串对象
int count = 0;
for (int x = 0; x < value.length(); x++) {
String single = String.valueOf(value.charAt(x));
if (single.matches(regex1) || single.matches(regex2)) {
count++;
}
}
System.out.println("value:" + value.length());
System.out.println("count:" + count);
if (value.length() == count) { //不包含特殊字符
return 0;
}
return 1; //包含特殊字符
}