List of utility methods to do String Truncate
String | trunc(String in, int len) This method is used to truncate a string to a specific length. if (in != null && in.length() > len) return in.substring(0, len); return in; |
String | trunc(String s, int length) Takes a string and a length, and truncates it to that that length. if (s.length() <= length) return s; else return s.substring(0, length); |
String | trunc(String s1, int length) trunc if (s1 == null) { return ""; if (s1.length() > length && length <= 2) { return s1.substring(0, length); if (s1.length() > length) { return s1.substring(0, length - 2) + ".."; ... |
String | trunc(String str, int length) truncate a String to the desired length if (str == null) str = "Error"; else if (str.length() >= length) str = str.substring(0, length); return str; |
String | trunc(String string, int length) Truncates the String by removing characters from the right side of the String so it is length characters long. int absLength = Math.abs(length); if ((string == null) || (string.length() <= absLength)) { return string; if (length < 0) { int sLength = string.length(); return string.substring(sLength - absLength, sLength); return string.substring(0, length); |
String | trunc(String txt, int size) trunc if (txt == null) return txt; else if (txt.length() > size) { return txt.substring(0, size - 1); } else { return txt; |
String | trunc(String value, int len) trunc if (len < value.length()) value = left(value, len); return value; |
String | truncate(final String description) Truncates the input description to maximum 100 character length. return truncate(description, 100);
|
String | truncate(final String in, final int maxLen) Truncates string to maxLen. if (in == null || in.length() <= maxLen) { return in; } else { return in.substring(0, maxLen); |
String | truncate(final String originalString, final int maxChars) Truncates a string to a given length if it exceeds the length. if (originalString == null) { return null; if (maxChars < 1) { return ""; if (maxChars >= originalString.length()) { return originalString; ... |