java 去掉换行符等特殊字符

来源:互联网 发布:c语言 void关键字 编辑:程序博客网 时间:2024/05/16 02:12
public static String removeSpecilChar(String str){
String result = "";
if(null != str){
Pattern pat = Pattern.compile("\\s*|\n|\r|\t");
Matcher mat = pat.matcher(str);
result = mat.replaceAll("");
}
return result;
}
原创粉丝点击