Here you can find the source of chomp(String in)
public static String chomp(String in)
//package com.java2s; //License from project: Open Source License public class Main { public static String chomp(String in) { if (in.endsWith("\r\n")) return in.substring(0, in.length() - 2); else if (in.endsWith("\n")) return in.substring(0, in.length() - 1); else//from w w w. j a v a2 s. c o m return in; } }