public static String trimTextDown(String text, int sizeMinusAppend, String append) {
    """
	Reduces text size to a given size
	
	@param text            to reduce
	@param sizeMinusAppend size final string should be max long
	@param append          string to append at the end to indicate trimming
	@return trimmed text with appended text of given max size, or original text if shorter than desired
    """

		Assert.notNull(append, "Missing append!");

		if (text == null || text.length() <= sizeMinusAppend) {
			return text;
		}

		sizeMinusAppend = sizeMinusAppend - append.length();

		int pos = text.lastIndexOf(" ", sizeMinusAppend);

		if (pos < 0) {
			return text.substring(0, sizeMinusAppend) + append;
		}

		return text.substring(0, pos) + append;
	}
public static String trimTextDown(String text, int sizeMinusAppend, String append) {

		Assert.notNull(append, "Missing append!");

		if (text == null || text.length() <= sizeMinusAppend) {
			return text;
		}

		sizeMinusAppend = sizeMinusAppend - append.length();

		int pos = text.lastIndexOf(" ", sizeMinusAppend);

		if (pos < 0) {
			return text.substring(0, sizeMinusAppend) + append;
		}

		return text.substring(0, pos) + append;
	}
public static String trimTextDown ( String text , int sizeMinusAppend , String append ) { Assert . notNull ( append , "Missing append!" ) ; if ( text == null || text . length ( ) <= sizeMinusAppend ) { return text ; } sizeMinusAppend = sizeMinusAppend - append . length ( ) ; int pos = text . lastIndexOf ( " " , sizeMinusAppend ) ; if ( pos < 0 ) { return text . substring ( 0 , sizeMinusAppend ) + append ; } return text . substring ( 0 , pos ) + append ; }
Reduces text size to a given size

@param text            to reduce
@param sizeMinusAppend size final string should be max long
@param append          string to append at the end to indicate trimming
@return trimmed text with appended text of given max size, or original text if shorter than desired
Reduces text size to a given size