List of utility methods to do File Base Name Get
String | basename(String path) basename if (path == null) return ""; path = path.replaceAll("/+$", ""); int i = path.lastIndexOf('/'); return (path.isEmpty()) ? "/" : (i == -1) ? path : path.substring(i + 1); |
String | basename(String path) basename int index = path.lastIndexOf('/'); if (index == -1) { throw new IllegalArgumentException("path does not contain '/'"); return path.substring(index + 1); |
String | basename(String path) basename return path.substring(path.lastIndexOf(PATH_SEP) + 1);
|
String | baseName(String path) Strips directory names and the query-string from a path. int begin = path.lastIndexOf('/') + 1; int end = path.indexOf(';'); if (end == -1) { end = path.indexOf('?'); if (end == -1) { end = path.length(); return path.substring(begin, end); |
String | basename(String path) Compute the name of the last part of the path. return path.substring(path.lastIndexOf('/') + 1); |
String | basename(String path, char separator) Strips the directory from a file path (if any) using the specified character as a separator. if (path.equals("")) { return path; while (path.endsWith(String.valueOf(separator))) { path = path.substring(0, path.length() - 1); int idx = path.lastIndexOf(separator); return idx == -1 ? path : path.substring(idx + 1); ... |
String | basename(String s) basename int dot = s.lastIndexOf('.'); return s.substring(0, dot); |
String | basename(String s) basename return basename(s, ""); |
String | basenamePart(String className) basename Part int lastdot = className.lastIndexOf('.'); return (lastdot == -1) ? className : className.substring(lastdot + 1); |