List of utility methods to do String Abbreviate
String | abbreviate(String str, int maximumChars) Abbreviates the specified if (!isEmpty(str)) { if (str.length() > maximumChars) { return (str.substring(0, maximumChars) + "..."); return (str); |
String | abbreviate(String str, int maxlen, String appendIfLimit) Return abbreviated string to maxlen length. if (appendIfLimit == null) appendIfLimit = ""; if (str.length() > maxlen) { return str.substring(0, maxlen - appendIfLimit.length()) + appendIfLimit; return str; |
String | abbreviate(String str, int maxWidth) Abbreviates a string to a specified length and then adds an ellipsis if the input is greater than the maxWidth. if (null == str) { return null; if (str.length() <= maxWidth) { return str; return str.substring(0, maxWidth) + "..."; |
String | abbreviate(String str, int maxWidth) abbreviate if (null == str) return null; if (str.length() <= maxWidth) return str; else return (new StringBuilder()).append(chopAtWord(str, maxWidth)).append("...").toString(); |
String | abbreviate(String str, int maxWidth) Abbreviates a String using ellipses. return abbreviate(str, 0, maxWidth);
|
String | abbreviate(String str, int maxWidth) abbreviate if (str == null) return null; if (maxWidth < 4) throw new IllegalArgumentException("Minimum abbreviation width is 4"); return str.substring(0, maxWidth - 3) + "..."; |
String | abbreviate(String str, int maxWidth) Abbreviates a String using ellipses. if (str == null) { return null; if (str.length() < maxWidth) { return str; if (maxWidth < 4) { throw new IllegalArgumentException("Minimum required width is 4"); ... |
String | abbreviate(String str, int maxWidth) Abbreviates a string to a specified length and then adds an ellipsis if the input is greater than the maxWidth. if (null == str) { return null; if (str.length() <= maxWidth) { return str; return str.substring(0, maxWidth) + "..."; |
String | abbreviate(String str, int maxWidth) abbreviate if (isBlank(str)) { return str; if (str.length() <= maxWidth) { return str; if (maxWidth < 3) { throw new IllegalArgumentException("maxWidth must be >= 3"); ... |
String | abbreviate(String str, int maxWidth) abbreviate return abbreviate(str, 0, maxWidth);
|