Ignore:
Timestamp:
2014-01-19T20:59:05+01:00 (10 years ago)
Author:
simon04
Message:

fix #7686 - Shorten long search expression for display purposes (in dialogs, tooltips)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r6740 r6742  
    947947        return biggerCopy;
    948948    }
     949
     950    /**
     951     * If the string {@code s} is longer than {@code maxLength}, the string is cut and "..." is appended.
     952     */
     953    public static String shortenString(String s, int maxLength) {
     954        if (s != null && s.length() > maxLength) {
     955            return s.substring(0, maxLength - 3) + "...";
     956        } else {
     957            return s;
     958        }
     959    }
    949960}
Note: See TracChangeset for help on using the changeset viewer.