Android examples for java.util.regex:Blank Remove
replace Blank \r or \n with regular expression
import android.content.Context; import android.text.TextUtils; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; 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("\r|\n"); Matcher m = p.matcher(str); dest = m.replaceAll(""); }/*w w w.ja va2s. c o m*/ return dest; } }