List of utility methods to do String Abbreviate
String | abbreviate(String fileName, int maxLen) Abbreviates a path name by replacing sub directories by an ellipsis character. if (fileName.length() <= maxLen) return fileName; File f = new File(fileName); ArrayList<String> coll = new ArrayList<String>(); String name; StringBuffer begBuf = new StringBuffer(); StringBuffer endBuf = new StringBuffer(); int len; ... |
String | abbreviate(String input, int length) Abbreviates a string to a desired length and adds "..." if (input == null) { return null; if (input.length() <= length) { return input; return input.substring(0, length) + "..."; |
String | abbreviate(String longName) Abbreviate a string. if (longName == null) { return "<Unnamed>"; if (longName.length() <= 80) { return longName; return longName.substring(0, 37) + ". . ." + longName.substring(longName.length() - 38); |
String | abbreviate(String longStr, int maxLength) abbreviate String _longStr = getEmptyIfNull(longStr); return _longStr.length() > maxLength ? _longStr.substring(0, maxLength - 2) + ".." : _longStr; |
String | abbreviate(String name) abbreviate StringBuilder newName = new StringBuilder(name); if (name.length() > 14) { for (int i = 0; i < (name.length() - 12); i++) { newName.deleteCharAt(newName.length() - 1); newName.append(".."); return newName.toString(); return name; |
String | abbreviate(String s, int length) abbreviate if (s == null) return null; if (s.length() <= length) return s; s = s.substring(0, length - 5); if (s.endsWith(" ")) { s += "..."; } else { ... |
String | abbreviate(String s, int max) Turn "Now is the time for all good men" into "Now is the time for..." if (max < 4) throw new IllegalArgumentException("Minimum abbreviation is 3 chars"); if (s.length() <= max) return s; return s.substring(0, max - 3) + "..."; |
String | abbreviate(String s, int maxLength) abbreviate s = String.valueOf(s); if (s.length() > maxLength) { s = s.substring(0, maxLength) + "..."; return s; |
String | abbreviate(String src, int maxlen, String replacement) abbreviate if (src == null) return ""; if (replacement == null) { replacement = ""; StringBuffer dest = new StringBuffer(); try { maxlen = maxlen - computeDisplayLen(replacement); ... |
String | abbreviate(String str) Abbreviates a string such that it doesn't straddle more than one line, and isn't very long. return abbreviate(str, 60);
|