public static String transformAllLineSeparators(String text){
  Pattern crlf=Pattern.compile("(\r\n|\r|\n|\n\r)");
  Matcher m=crlf.matcher(text);
  if (m.find()) {
    text=m.replaceAll("\n");
  }
  return text;
}

public static String transformAllLineSeparators ( String text ) { Pattern crlf = Pattern . compile ( "(\r\n|\r|\n|\n\r)" ) ; Matcher m = crlf . matcher ( text ) ; if ( m . find ( ) ) { text = m . replaceAll ( "\n" ) ; } return text ; }
replaces all possible line feed character combinations by & quot ; \ n & quot ; . this might be important for gui purposes like tool tip texts which do not support carriage return combinations .
