List of utility methods to do String Truncate
String | truncateFirstEnd(String str) truncate First End if (isEmpty(str)) return str; String tmp = str.substring(1); return tmp.substring(0, tmp.length() - 1); |
int | truncateHashToInt(String hash) Computes a truncated code from the given hash-value and returns it as int-variable. return truncateHashToInt(hexToBytes(hash));
|
String | truncateIfTooLong(String string, int maxLength) truncate If Too Long if (string.length() > maxLength) { return string.substring(0, maxLength) + "..."; } else { return string; |
String | truncateIgnoreCase(String aString, String trailingSubString) Return a substring of the first parameter, up to the last index of the second int index = aString.toLowerCase().lastIndexOf(trailingSubString.toLowerCase()); if (index != -1) return aString.substring(0, index); return aString; |
int | truncateInt(String intStr) truncate Int int len = intStr.length(); int result = 0; for (int i = 0; i < len; i++) { char c = intStr.charAt(i); if (c >= '0' && c <= '9') { result = result * 10; result += c - '0'; } else { ... |
String | truncateJavaBeanMethodName(String methodName, int prefixLength) truncate Java Bean Method Name if (methodName.length() <= prefixLength) { return null; methodName = methodName.substring(prefixLength); if (methodName.length() == 1) { return methodName.toLowerCase(); char firstChar = methodName.charAt(0); ... |
String | truncateLabel(String label) Truncates the Specified label to MAX_LENGTH Chars. String newLabel = label; if (label.length() > MAX_LENGTH) { newLabel = label.substring(0, MAX_LENGTH) + "..."; return newLabel; |
String | truncateLeadingSlash(String uri) Any leading / in the given uri will be removed.
if (uri == null) { return uri; while (uri.startsWith("/")) { uri = uri.substring(1); return uri; |
String | truncateLongName(String name, int nameLength) Automatically Truncates Long Names. if (name != null) { if (name.length() > nameLength) { name = name.substring(0, nameLength - 3) + "..."; return entityFilter(name); |
String | truncateLongStr(String str) truncate Long Str if (str != null) { str = str.replaceAll("[\n\r \t]+", " "); if (str.length() > MAX_DISPLAY_STRING_LEN) { str = str.substring(0, MAX_DISPLAY_STRING_LEN / 2 - 1) + "..." + str.substring(str.length() - MAX_DISPLAY_STRING_LEN / 2); return str; ... |