Android Utililty Methods Path to File Name Convert

List of utility methods to do Path to File Name Convert

Description

The list of methods to do Path to File Name Convert are organized into topic(s).

Method

intgetFileNameIndexFromPath(String filePathName)
get File Name Index From Path
if (filePathName.toLowerCase().lastIndexOf("/") > -1) {
    return filePathName.toLowerCase().lastIndexOf("/");
} else {
    return filePathName.toLowerCase().lastIndexOf("\\");
StringgetFilename(String path)
get Filename
if (path == null) {
    return null;
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR);
return (separatorIndex != -1 ? path.substring(separatorIndex + 1)
        : path);
StringgetShortFileName(String fullFileName)
get Short File Name
int pos = fullFileName.lastIndexOf("/");
if (pos == -1) {
    pos = fullFileName.lastIndexOf("\\");
String shortFileName = fullFileName.substring(pos + 1,
        fullFileName.length());
return shortFileName;
StringextractFolderOrFilename(String path)
extract Folder Or Filename
return regexExtract(path, "[^/]*$");
StringgetFileName(String path)
get File Name
return path.substring(path.lastIndexOf("/") + 1, path.length());