Here you can find the source of combineBlank(String str)
public static String combineBlank(String str)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String combineBlank(String str) { String dest = str;/*from w w w .j a va 2s .c om*/ if (str != null) { Pattern p = Pattern.compile("\t"); Matcher m = p.matcher(str); dest = (m.replaceAll(" ")).trim().replaceAll(" +", " "); } else { dest = ""; } return dest; } }