List of utility methods to do String Truncate
String | truncate(final String s, final int n) Retrieves the first n characters of s, or all of s if its length is less than n return length(s) <= n ? s : s.substring(0, n);
|
String | truncate(final String str, final int len) truncate return (str.length() <= len) ? str : str.substring(0, len);
|
String | truncate(final String str, final int len) truncate a string if it longer than the argument if (str == null) { throw new NullPointerException("String is null"); if (len < 0) { throw new IndexOutOfBoundsException("Length is less than zero"); if (str.length() > len) { return str.substring(0, len); ... |
String | truncate(final String str, final int maxWidth) Method to truncate the string when max width is given return truncate(str, 0, maxWidth);
|
String | truncate(final String target, final int maxSize) truncate return (target.length() > maxSize ? target.substring(0, maxSize) : target);
|
String | truncate(final String value, final int width) Truncate a string if the desired with is less than the length of the input string. if (width >= value.length()) { return value; return value.substring(0, width - 3) + "..."; |
String | truncate(Object truncateMe, int maxLength, String suffix) Limits the string value of 'truncateMe' to the specified max length in characters. return truncate(truncateMe, maxLength, suffix, true);
|
String | truncate(String eval, String suffix, int targetLength) truncate if (eval.length() > targetLength) return eval.substring(0, targetLength - 1) + suffix; else return eval; |
String | truncate(String input, int maxLength) Truncates the passed String to the passed maximum length, if it exceeds the maximum length. if (input != null && input.length() > maxLength) { return input.substring(0, maxLength); return input; |
String | truncate(String input, int maxLength) Truncates the input sting so that it is not longer than maxLength. String ellipsis = "\u2026"; return truncate(input, maxLength, ellipsis); |