JAVA字符串去除特殊字符内容

1 //带有特殊符号字符串示例
2 String str = "我的名字(测试)";
3 
4 //去除特殊字符内容 其中的“()”为特殊字符
5 str.replaceAll("[^0-9a-zA-Z\u4e00-\u9fa5.,,。?“”]+","");
6 
7 //去除特殊符号后字符串内容:
8 System.out.println("字符串str:" + str");// str:我的名字测试

 

posted @ 2017-12-19 14:55  没有听见下雨的声音  阅读(36180)  评论(0编辑  收藏  举报