当字符串方法replaceAll()中替换字符含有特殊字符$如,

String test  = "<StreamingNo>abc</StreamingNo>";
test = test.replaceAll("abc", "1111111111$$");

会报异常,解决方法为改写以下形式:

test = test.replaceAll("abc", java.util.regex.Matcher.quoteReplacement("dXNlcjM1NDk2NQ$$"));

参考:http://cuisuqiang.iteye.com/blog/2062173

 

相关文章:

  • 2022-12-23
  • 2021-04-17
  • 2021-10-28
  • 2022-01-21
  • 2021-09-22
  • 2022-03-03
  • 2021-04-09
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-03-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案