public static String chop(String s,int i,String eol){
  if (i == 0 || s == null || eol == null) {
    return s;
  }
  int length=s.length();
  if (eol.length() == 2 && s.endsWith(eol)) {
    length-=2;
    i-=1;
  }
  if (i > 0) {
    length-=i;
  }
  if (length < 0) {
    length=0;
  }
  return s.substring(0,length);
}

public static String chop ( String s , int i , String eol ) { if ( i == 0 || s == null || eol == null ) { return s ; } int length = s . length ( ) ; if ( eol . length ( ) == 2 && s . endsWith ( eol ) ) { length -= 2 ; i -= 1 ; } if ( i > 0 ) { length -= i ; } if ( length < 0 ) { length = 0 ; } return s . substring ( 0 , length ) ; }
chop i characters off the end of a string . a 2 character eol will count as 1 character .
