Java Utililty Methods Path Tail

List of utility methods to do Path Tail

Description

The list of methods to do Path Tail are organized into topic(s).

Method

Stringtail(String path)
tail
int index = path.length() - 1;
if (index >= 0 && index < path.length() && path.charAt(index) == '/') {
    index--;
for (int i = index; i >= 0; i--) {
    if (path.charAt(i) == '/') {
        return path.substring(i + 1, index + 1);
return path;
Stringtail(String path)
tail
int sepIdx = path.indexOf(SEP);
if (sepIdx == -1) {
    return "";
return path.substring(sepIdx + 1);
Stringtail(String path)
tail
path = removeTrailingSlash(path);
int index = path.lastIndexOf('/');
if (index >= 0) {
    return path.substring(index + 1);
return path;