List of utility methods to do String Shorten
String | shorten(String msg, int front, String join, int end) General short string helper. if (msg.length() <= (front + join.length() + end)) return msg; return msg.substring(0, front) + join + msg.substring(msg.length() - end); |
String | shorten(String name, int max) shorten int index = name.indexOf(' '); while (name.length() > max && index != -1) { name = name.substring(index + 1); index = name.indexOf(' '); return name; |
String | shorten(String nameForUI, int maxLen) shorten if (nameForUI.length() >= maxLen) { maxLen -= 5; int first = maxLen / 2; int last = maxLen / 2 + (maxLen % 2); return nameForUI.substring(0, first) + " ... " + nameForUI.substring(nameForUI.length() - last, nameForUI.length()); return nameForUI; ... |
String | shorten(String pkg, boolean shorten) shorten if (!shorten) { return pkg; String[] parts = pkg.split("\\."); StringBuilder result = new StringBuilder(); for (int i = 0; i < parts.length - 1; i++) { result.append(parts[i].charAt(0)); result.append("."); ... |
String | shorten(String s) shorten if (null == s) { return "NULL"; if (s.indexOf("\n") > -1) { int lines = s.split("\n").length; int length = s.length(); s = s.replaceAll("\n", "\\n"); return String.format("%s(...)%s (len: %d, lines: %d)", s.substring(0, 10), ... |
String | shorten(String s) shorten return shorten(s, 20);
|
String | shorten(String s) Returns a string representing the original string appended with suffix "..." return shorten(s, 20);
|
String | shorten(String s) shorten return shorten(s, 20);
|
String | shorten(String s, int len) Shortens the string "s" to a length of "len" characters. if (s == null) return null; if (s.length() > len) s = s.substring(0, len - 2) + ".."; return s; |
String | shorten(String s, int length) Shorten a string using elipses (...) if (s.length() > length) { s = s.substring(0, length - 1) + "..."; return s; |