String hh = ht.replaceAll("\\s", ""); replaceAll 把多个字符换成一个 String ff = first.replaceAll("[Aa(),\\s]", "a");