Java tutorial
//package com.java2s; //License from project: Apache License import android.text.TextUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String replaceAllBlank(String str) { if (TextUtils.isEmpty(str)) return ""; Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = p.matcher(str); String dest = m.replaceAll(""); return dest; } }