前言 总结Java中字符串的处理 replace() public String replace(char oldChar, char newChar) 其中newChar不可以是’’(空字符)replaceAll() replaceAll(String regex, String replacement) 其中regex是正则表达式 eg: String str = "2018-01-02"; System.out.println(str.replaceAll("-","")); //输出20180102