Android examples for java.util.regex:Blank Remove
remove Blank Lines from string using replaceAll and regular expression
public class Main{ public static String rmvBlankLines(String input) { return input.replaceAll("((\r\n)|\n)[\\s\t ]*(\\1)+", "$1"); }/* w ww . java 2s . c o m*/ }