文字处理工具合集

2021-08-16  本文已影响0人  JamesYang1624

正则匹配去除空格

        Pattern pattern = compile("[\\s\\p{Zs}]");
        Matcher re = pattern.matcher(s);
        String s= re.replaceAll("");

只使用使用

 replace(char oldChar, char newChar)

或者

replaceAll(char oldChar, char newChar)

是达不到想要的效果

上一篇 下一篇

猜你喜欢

热点阅读