Here you can find the source of deleteEmptyLine(String str)
public static String deleteEmptyLine(String str)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String deleteEmptyLine(String str) { String dest = str;//from w w w .j a v a2 s. c om if (str != null) { Pattern p = Pattern.compile("\r|\n"); Matcher m = p.matcher(str); dest = m.replaceAll(""); } return dest; } }