List of utility methods to do Path to File Name Convert
int | getFileNameIndexFromPath(String filePathName) get File Name Index From Path if (filePathName.toLowerCase().lastIndexOf("/") > -1) { return filePathName.toLowerCase().lastIndexOf("/"); } else { return filePathName.toLowerCase().lastIndexOf("\\"); |
String | getFilename(String path) get Filename if (path == null) { return null; int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path); |
String | getShortFileName(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; |
String | extractFolderOrFilename(String path) extract Folder Or Filename return regexExtract(path, "[^/]*$"); |
String | getFileName(String path) get File Name return path.substring(path.lastIndexOf("/") + 1, path.length()); |