List of utility methods to do File Name Extract
String | extractFileName(final String filePath) extract File Name String result; int pos = filePath.lastIndexOf(fileSeparator); if (pos < 0) { result = filePath; } else { result = filePath.substring(pos + 1, filePath.length()); return result; ... |
String | extractFileName(StackTraceElement aFrame) extract File Name String fileName = aFrame.getFileName(); if (fileName != null) { int atIndex = fileName.indexOf("@"); if (atIndex != -1) { fileName = fileName.substring(0, atIndex); return fileName; } else { ... |
String | extractFileName(String file) extract File Name if (file.matches("^(\\w){2,}:.*")) return null; else if (file.matches("^\\/.*")) return file; else if (file.matches("^\\w:[\\\\,\\/].*")) { file = file.replaceAll("\\\\", "\\/"); return "/" + file; } else if (file.matches("^(\\.)+\\/.*|^\\w+\\/.*|^\\w+.*")) ... |
String | extractFileName(String fileName) extract File Name if (null == fileName || "".equals(fileName.trim())) { throw new IllegalArgumentException("File Name cannot be Null/Empty"); int extensionStartPt = fileName.lastIndexOf("."); return fileName.substring(0, extensionStartPt); |
String | extractFileName(String filePathName) Extract file name (without path and suffix) from file name with path and suffix. if (filePathName == null) return null; int dotPos = filePathName.lastIndexOf('.'); int slashPos = filePathName.lastIndexOf('\\'); int backSlashPos = filePathName.lastIndexOf('/'); slashPos = slashPos > backSlashPos ? slashPos : backSlashPos; if (dotPos > slashPos) { return filePathName.substring(slashPos > 0 ? slashPos + 1 : 0, dotPos); ... |
String | extractFileName(String filePathName) extract File Name if (filePathName == null) { return null; int dotPos = filePathName.lastIndexOf('.'); int slashPos = filePathName.lastIndexOf('\\'); if (slashPos == -1) { slashPos = filePathName.lastIndexOf('/'); if (dotPos > slashPos) { return filePathName.substring(slashPos > 0 ? slashPos + 1 : 0, dotPos); return filePathName.substring(slashPos > 0 ? slashPos + 1 : 0); |
String | extractFileName(String fn) extract File Name int j = lastIndexOfPathSeparator(fn); if (j == -1) { return fn; return (fn.substring(j + 1)); |
String | extractFileName(String fullPath) extract File Name String sep1 = "/"; String sep2 = "\\"; if (fullPath.lastIndexOf(sep1) >= 0) { return fullPath.substring(fullPath.lastIndexOf(sep1) + 1); } else if (fullPath.lastIndexOf(sep2) >= 0) { return fullPath.substring(fullPath.lastIndexOf(sep2) + 1); return fullPath; ... |
String | extractFileName(String name) extract File Name return name.substring(0, 8);
|
String | extractFilename(String path) extract Filename if (path == null) return null; String norm = path.replace('\\', '/'); int i = norm.lastIndexOf('/'); if (i == -1) { return path; } else { return norm.substring(i + 1); ... |