public static String chomp(String s){
  if (s.endsWith("\r\n"))   return s.substring(0,s.length() - 2);
  if (s.endsWith("\r") || s.endsWith("\n"))   return s.substring(0,s.length() - 1);
  return s;
}

public static String chomp ( String s ) { if ( s . endsWith ( "\r\n" ) ) return s . substring ( 0 , s . length ( ) - 2 ) ; if ( s . endsWith ( "\r" ) || s . endsWith ( "\n" ) ) return s . substring ( 0 , s . length ( ) - 1 ) ; return s ; }
removes a line - break from the end of the string ( if there ' s any ) .
