List of utility methods to do File Extension Name Get
String | fileExtension(String filename) file Extension String extension = ""; int i = filename.lastIndexOf('.'); int p = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\')); if (i > p) { extension = filename.substring(i + 1); return extension; |
String | fileExtension(String path) file Extension int token = path.lastIndexOf("."); String ext = path.substring(token + 1, path.length()).toLowerCase(); return ext; |
String | getFileExtension(File _file) Extracts the file extension (part behind last dot of a filename). return getFileExtension(_file.getAbsolutePath());
|
String | getFileExtension(File f) get File Extension String[] split = f.getName().split("\\."); if (split.length > 1) { return split[1]; } else { return null; |
String | getFileExtension(File f) Get the file extension (if present). return getFileExtension(f.getName());
|
String | getFileExtension(File f) get File Extension return getFileExtension(f.getAbsolutePath());
|
String | getFileExtension(File f) Returns file's extension. String name = (f != null) ? f.getName() : null; if ((name == null) || (name.length() == 0)) { return ""; int pos = name.lastIndexOf('.'); return ((pos > 0) && (pos < (name.length() - 1))) ? name.substring(pos) : ""; |
String | getFileExtension(File f) Return the file extension (the last part of the name after the last '.'). if (f == null) return null; String fn = f.getName(); if (fn.length() <= 0 || fn.startsWith(".")) return fn; int p = fn.lastIndexOf('.'); if (p < 0) return ""; ... |
String | getFileExtension(File f) Gets the file extension. String result; if (f.isDirectory()) result = null; else { int index = f.getName().lastIndexOf('.'); result = index < 0 || index + 1 == f.getName().length() ? "" : f.getName().substring(index + 1); return result; ... |
String | getFileExtension(File f) Utility function to return the lower-cased file extension - the part of the filename after the last period. String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i + 1).toLowerCase(); return ext; |