public static String removeEmptyLines(String text){
  text=text.replaceAll("^[ " + ChineseLanguageConstants.SPACE[0] + "\t\u000B\u000C\u00A0\uE5F1\r\n]*\n","");
  text=text.replaceAll("[\r\n][ " + ChineseLanguageConstants.SPACE[0] + "\t\u000B\u000C\u00A0\uE5F1\r\n]*\n","\n");
  return text;
}

public static String removeEmptyLines ( String text ) { text = text . replaceAll ( "^[ " + ChineseLanguageConstants . SPACE [ 0 ] + "\t \r\n]*\n" , "" ) ; text = text . replaceAll ( "[\r\n][ " + ChineseLanguageConstants . SPACE [ 0 ] + "\t \r\n]*\n" , "\n" ) ; return text ; }
remove empty lines . an empty line means a line ends in \ n or \ r \ n and contains only white space characters , or no characters at all .
