List of utility methods to do String Truncate
String | truncateToLength(String inputString, int truncateLength) Method which returns a truncated version of inputString. try { if (truncateLength > inputString.length() - 1) return inputString; else return inputString.substring(0, truncateLength); } catch (Exception e) { if (inputString == null) return " "; ... |
String | truncateToMaxLen(String input, int len) truncate To Max Len if (input != null && input.length() > 0) { if (input.length() > len) { return input.substring(0, len); return input; |
String | truncateType(String s) truncate Type if ((s == null) || (s.length() == 0)) return ""; String[] stringTokens = s.split("\\|"); return (stringTokens[0].toUpperCase()); |
String | truncateType(String type) truncate Type if (type.contains("Class")) type = type.substring(0, type.indexOf("Class")); else if (type.contains("Inst")) type = type.substring(0, type.indexOf("Inst")); else if (type.contains("Symbol")) { type = type.substring(0, type.indexOf("Symbol")); return type; ... |
String | truncateUri(String uri) truncate Uri if (uri == null) return null; int idx = uri.lastIndexOf("#"); if (idx < 0) idx = uri.lastIndexOf("/"); if (idx < 0) return uri; return uri.substring(idx + 1); ... |
String | truncateUrl(String url) truncate Url if (url.contains("?")) url = url.substring(0, url.indexOf("?")); return url; |
String | TruncateUrlPage(String strURL) Truncate Url Page String strAllParam = null; String[] arrSplit = null; strURL = strURL.trim().toLowerCase(); arrSplit = strURL.split("[?]"); if (strURL.length() > 1) { if (arrSplit.length > 1) { if (arrSplit[1] != null) { strAllParam = arrSplit[1]; ... |
String | truncateValue(String value, int limit, String endChars) Truncate a String and add final end chars to them if (!value.equals(null) && value.length() > limit) value = value.substring(0, limit - endChars.length()) + endChars; return value; |
String | truncateWhenUTF8(final String s, final int maxBytes) truncate When UTF int b = 0; for (int i = 0; i < s.length(); i++) { final char c = s.charAt(i); int skip = 0; int more; if (c <= 0x007f) { more = 1; } else if (c <= 0x07FF) { ... |
String | truncateWhiteSpace(int len, int tabSize, String indentStr) truncate White Space StringBuilder buf = new StringBuilder(); int indent = 0; for (int i = 0; indent < len && i < indentStr.length(); i++) { char c = indentStr.charAt(i); if (c == ' ') { indent++; buf.append(c); } else if (c == '\t') { ... |