public static String replaceBlank(String str) { String dest = ""; if (str != null) { //Pattern p = Pattern.compile("\s*| | | |\x20"); Pattern p = Pattern.compile("\s*| | | "); Matcher m = p.matcher(str); dest = m.replaceAll(""); } return dest;}