/*** 判断该地址是否包含异常字符(除中英文、阿拉伯数字、#、-、空格、——、_的其他符号),若包含,则返回1,反之返回0;* @param value* @return*/private static int matching(String value) {//自定义符号value = value.replace(" ", "").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; //包含特殊字符}
200字范文,内容丰富有趣,生活中的好帮手!