java怎么用replaceAll替换掉字符串中的圆括号? 在线急等!!!

一下方案都无法解决问题,还有没有其他答案

String str = "(nihao),(henhao),(nichilema?),(chiguole)";
String str2 = str.replaceAll("[( )]", "~");
System.out.println(str2);
//注意这对括号中间有一个空格的
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-11-01
replaceAll("[\\(\\)]","?")
第2个回答  2011-11-01
参考:
String str = "(nihao),(henhao),(nichilema?),(chiguole)";
String str2 = str.replaceAll("\\(|\\)", "~");
System.out.println(str2);
第3个回答  2011-11-01
String s = "(1()1(1()1(1(1";
System.err.println(s.replace("()", ""));
第4个回答  2011-11-01
String a="(1,2,3)";
a=a.replaceAll("[(,)]","");
System.out.println(a);
相似回答