Sta*_*ckd -3 java regex
如何使用replaceAll()方法替换括号?例如,如果我有字符串,"[][]teststring]]]]"我想使用replaceAll()将其减少为"teststring".
"[][]teststring]]]]"
Tim*_*per 6
假设你只想摆脱方括号:
String output = "[][]teststring]]]]".replaceAll("[\\[\\]]", "");
我还建议你看看正则表达式文档.
归档时间:
13 年,3 月 前
查看次数:
403 次
最近记录: