去除字符串中的 - 符号; 其实也就是将原本想要去除的字符替换为空而已。 String str = "sdfsd-sdfsdf-sdfvsds-fsdfzxv"; String s = str.replaceAll("-",""); System.out.println(s);