List of utility methods to do File Extension Name Extract
String | getFileExtension(String filename, String extensionSeparator) Returns the extension of a filename. int extindex = filename.lastIndexOf(extensionSeparator); if (extindex >= 0) return filename.substring(extindex + 1); return ""; |
String | getFileExtension(String filePath) Get the extension of a file. return getFileExtension(new File(filePath)); |
String | getFileExtensionIgnoringGz(File f) get File Extension Ignoring Gz String name = f.getName().toLowerCase(); if (name.endsWith(".gz")) { name = name.substring(0, name.length() - 3); return getFileExtension(name); |