java中正则表达式替换字符串中的中括号


//替换成空字符串

String  ss = "[a12,da,das]";

String replaceAll = ss.replaceAll("[\\[\\]]","");

System.out.println(replaceAll);// a12,da,das



//替换小括号同样原理

String  ss = "(a12,da,das)";
String replaceAll = ss.replaceAll("[\\(\\)]","");
System.out.println(replaceAll);// a12,da,das

posted @ 2022-04-13 19:21  随★风  阅读(1469)  评论(0编辑  收藏  举报