Changeset 15864 in josm for trunk/src/org
- Timestamp:
- 2020-02-16T15:46:03+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r15863 r15864 1076 1076 * @param maxLength maximum number of characters to keep (not including the "...") 1077 1077 * @return the shortened string 1078 * @throws IllegalArgumentException if maxLength is less than the length of "..." 1078 1079 */ 1079 1080 public static String shortenString(String s, int maxLength) { 1081 final String ellipses = "..."; 1082 CheckParameterUtil.ensureThat(maxLength >= ellipses.length(), "maxLength is shorter than " + ellipses.length()); 1080 1083 if (s != null && s.length() > maxLength) { 1081 return s.substring(0, maxLength - 3) + "...";1084 return s.substring(0, maxLength - ellipses.length()) + ellipses; 1082 1085 } else { 1083 1086 return s;
Note:
See TracChangeset
for help on using the changeset viewer.