/**
*
* @param filterString 过滤字符串
* @param length 字符串长度
* @return
*/

public static String tongXinFilterString(String filterString, int length) {
if (filterString == null || filterString.trim().equals("")) {
return "";
}
String filter = "";
String str = filterString.replaceAll("//&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "");
str = str.replaceAll("[(/>)<]", "");
str = str.replaceAll("[a-zA-Z]", "");//字母
// str = str.replaceAll("[0-9]","");//数字

int len = str.length();
if (len <= length) {
return str;
} else {
str = str.substring(0, length);
}
return str;
}

//会有 css样式过滤不了,判断从首个汉字开始截取—到最后
char[] charValue= filter.toCharArray();
for(int i=0;i<charValue.length;i++){
if(isChinese(charValue[i])){
filter=filter.substring(i);
break;
}
}


/**
* 判断是否是字符串
* @param a
* @return
*/
public static boolean isChinese(char a) {
return String.valueOf(a).matches("[\u4E00-\u9FA5]"); //利用正则表达式,经测试可以区分开中文符号
}