Android examples for java.util.regex:Blank Remove
replace Blank in string via regular expression
import android.text.TextUtils; import java.math.BigDecimal; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String replaceBlank(String str) { String dest = ""; if (str != null) { Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = p.matcher(str); dest = m.replaceAll(""); }// w ww.j a va 2s . co m return dest; } }