Here you can find the source of replaceBlank(String str)
public static String replaceBlank(String str)
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String replaceBlank(String str) { if (str != null) { Pattern p = Pattern.compile("\t|\r|\n"); Matcher m = p.matcher(str); return m.replaceAll("").trim(); }/*from www .jav a 2 s . co m*/ return null; } public static String trim(String name) { if (null != name) { return name.trim(); } return null; } }