Posted on 2011-01-06 09:00
非洲小白脸 阅读(1152)
评论(0) 编辑 收藏 所属分类:
其他资源
String str = "abc'\"\\&/$#<>";
System.out.println(str);
str = str.replaceAll("[']", "B");
str = str.replaceAll("[\"]", "B");
str = str.replaceAll("[\\\\]", "B");
str = str.replaceAll("[/]", "B");
str = str.replaceAll("[&]", "B");
str = str.replaceAll("[$]", "B");
str = str.replaceAll("[#]", "B");
str = str.replaceAll("[<]", "B");
str = str.replaceAll("[>]", "B");
两处输出内容:
abc'"\&/$#<>
abcBBBBBBBBB