美文网首页
文字处理工具合集

文字处理工具合集

作者: JamesYang1624 | 来源:发表于2021-08-16 15:54 被阅读0次

正则匹配去除空格

        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)

是达不到想要的效果

相关文章

网友评论

      本文标题:文字处理工具合集

      本文链接:https://www.haomeiwen.com/subject/jxombltx.html