public static String trimBy ( final StringBuilder s , final int left , final int right ) { return s . substring ( left , s . length ( ) - right ) ; }
Remove the given number of chars from start and end . There is no parameter checking the caller has to take care of this .