2020
10-10
10-10
java去除中文括号小括号,或者英文括号的实例代码
我就废话不多说,大家还是直接看代码吧~/****英文*/Stringabc1="百度科技(123)公司1";abc1=abc1.replaceAll("\\(|\\)","");System.out.println(abc1);/***中文*/Stringabc2="百度科技(123)公司2";abc2=abc2.replaceAll("(","").replaceAll(")","");System.out.println(abc2);补充知识:java用正则匹配中文中括号,和英文中括号Stringregex="(?<=\\[)(\\S+)(?=\\])|(?<=【)[^】]*";Pattern...
继续阅读 >