sermo-core/src/main/java/com/headstartech/sermo/screen/TextElide.java
public static String elidedString(String str, TextElide elide) {
        if(str == null || NONE.equals(elide.getMode())) {
            return str;
        }

        if (str.length() <= elide.getMaxLen()) {
            return str;
        }

        if(RIGHT.equals(elide.getMode())) {
            return str.substring(0, elide.getMaxLen() - elide.getNumEllipsis()) + repeat(".", elide.getNumEllipsis());
        } else {
            throw new RuntimeException(String.format("Unknown elide mode: %s", elide.getMode()));
        }
    }
/**
     * Returns an elided version of the string (i.e. a string with "..." in it) if the string is wider than the max length.
     * Otherwise, returns the original string.
     *
     * Mode RIGHT specifies the text is elided on the right (e.g. "abcdefghijk" returns "abcd...").
     *
     * The width is specified in pixels, not characters.
     * @param str
     * @param elide
     * @return
     */
Returns an elided version of the string  if the string is wider than the max length.
Otherwise, returns the original string.

Mode RIGHT specifies the text is elided on the right .

The width is specified in pixels, not characters.
@param str
@param elide
@return
Returns an elided version of the string if the string is wider than the max length . Otherwise returns the original string . Mode RIGHT specifies the text is elided on the right . The width is specified in pixels not characters . @param str @param elide @return
public static String elidedString(String str, TextElide elide) {
        if(str == null || NONE.equals(elide.getMode())) {
            return str;
        }
        if (str.length() <= elide.getMaxLen()) {
            return str;
        }
        if(RIGHT.equals(elide.getMode())) {
            return str.substring(0, elide.getMaxLen() - elide.getNumEllipsis()) + repeat(".", elide.getNumEllipsis());
        } else {
            throw new RuntimeException(String.format("Unknown elide mode: %s", elide.getMode()));
        }
    }
public static String elidedString ( String str , TextElide elide ) { if ( str == null || NONE . equals ( elide . getMode ( ) ) ) { return str ; } if ( str . length ( ) <= elide . getMaxLen ( ) ) { return str ; } if ( RIGHT . equals ( elide . getMode ( ) ) ) { return str . substring ( 0 , elide . getMaxLen ( ) - elide . getNumEllipsis ( ) ) + repeat ( "." , elide . getNumEllipsis ( ) ) ; } else { throw new RuntimeException ( String . format ( "Unknown elide mode: %s" , elide . getMode ( ) ) ) ; } }
Returns an elided version of the string (i.e.
Returns an elided version of the string ( i . e .