String str = "给商品||?>\\n阳澄湖大闸蟹!@#$%^&*()_+-=?:\",.]\\|~.,\/??\\\\|\\br点赞"
1 String tradeDescription = "||?>\\n阳澄湖大闸蟹!@#$%^";
2 String description = "给商品 #goodsName# 点赞";
3 String result = description.replaceAll("#goodsName#", Matcher.quoteReplacement(CommonUtil.toString(tradeDescription)));

 

 

 

参考:

 

http://www.colabug.com/thread-1131948-1-1.html

相关文章: