List of utility methods to do String Suffix
int | suffix(final String source, final String target) Find the length of a common suffix. int pointermin = 0; int pointermax = Math.min(source.length(), target.length()); int pointermid = pointermax; while (pointermin < pointermid) { if (source.regionMatches(source.length() - pointermid, target, target.length() - pointermid, pointermid)) { pointermin = pointermid; } else { ... |
String | suffix(String fname) suffix int index = fname.lastIndexOf('.'); if (index < 0) { return ""; return fname.substring(index + 1).toLowerCase(); |
String | suffix(String input, char delimiter) Return the remainder of the string after the last occurrence of the delimiter char if (input == null) { return null; int pos = input.lastIndexOf(delimiter); if (pos >= 0) { if (input.length() > pos + 1) { return input.substring(pos + 1); } else { ... |
String | suffix(String mime) Suggests a file name suffix for the given content type. switch (mime) { case "image/png": return "png"; case "image/jpeg": return "jpg"; case "image/gif": return "gif"; default: ... |
String | suffix(String name, char separator) Returns the suffix of a String. if (name == null) return null; int separatorIndex = name.lastIndexOf(separator); if (separatorIndex < 0 || separatorIndex == name.length() - 1) return null; else return name.substring(separatorIndex + 1); |
String | suffix(String name, String suffix) suffix return (suffix == null) ? name : name + suffix;
|
String | suffix(String prefix, String path) Return path relative to prefix (its suffix, but without leading slash). if (!path.startsWith(prefix)) { return null; int end = prefix.length(); if (path.length() > end && path.charAt(end) == '/') { end++; return path.substring(end); ... |
String | suffix(String s, int delim) Extract the portion of s after the last occurrence of the given delimiter. int index = s.lastIndexOf(delim); return (index == -1) ? s : s.substring(index + 1); |
String | suffix(String s, String suffix) suffix if (!s.endsWith(suffix)) { s = s + suffix; return s; |
String | suffix(String str, int width, String with) suffix StringBuffer ret = new StringBuffer(str); while (ret.length() < width) ret.append(with); return ret.toString(); |