public static String convertLineEndings(final String input){
  return input.replaceAll("(\r\n)|\r|\n",LS);
}

public static String convertLineEndings ( final String input ) { return input . replaceAll ( "(\r\n)|\r|\n" , LS ) ; }
converts line endings in the given string to line endings of current platform
