List of utility methods to do File Extension Name Get
String | extractExtension(final String fileName) Extract the file extension from a string. final int dotIndex = fileName.lastIndexOf('.'); if (dotIndex != -1) { return fileName.substring(dotIndex + 1); } else { return null; |
String | extractExtension(String fileName) Extract the file-extension String extension = null; if (fileName == null) { extension = ""; } else { int place = fileName.lastIndexOf('.'); if (place >= 0) { extension = fileName.substring(place + 1); } else { ... |
String | extractExtension(String name) extract Extension if (name == null) return null; int dot = name.lastIndexOf('.'); if (dot > -1 && dot < name.length() - 1) return name.substring(dot + 1, name.length()); else return null; |
String | extractExtension(String s) does not include the dot. int index = s.lastIndexOf("."); if (index < 0) return ""; return s.substring(index + 1, s.length()); |
String | extractExtension(String strFilename) Extracts file extension from filename. return extractExtension(strFilename, "xml"); |
String | extractExtension(String url) Extract the extension from the given URL. int index = url.lastIndexOf('/'); if (index != -1) { url = url.substring(index + 1); index = url.lastIndexOf('.'); if (index == -1) { return null; url = url.substring(index + 1); int end = url.indexOf('?'); if (end != -1) { url = url.substring(0, end); end = url.indexOf('#'); if (end != -1) { url = url.substring(0, end); return url; |
String | extractExtensions(String fileName) extract Extensions int pos = fileName.lastIndexOf("."); if (pos == -1) return ""; return fileName.substring(fileName.lastIndexOf(".")); |
String | fileExt(String name) Return filename extension. String ext = null; String fname = pathName(name); int index = fname.indexOf("."); if (index > 0) ext = fname.substring(index, fname.length()); return ext; |
String | fileExt(String url) file Ext String ext = url.substring(url.lastIndexOf(".")); if (ext.contains("?")) { ext = ext.substring(0, ext.indexOf("?")); if (ext.contains("%")) { ext = ext.substring(0, ext.indexOf("%")); return ext; ... |
String | fileExtension(CharSequence path) Given a file name, this method checks to see if path ends with an extension such as ".java", ".yml", etc. int index = findExtension(path); if (index >= 0) { return path.subSequence(index, path.length()).toString(); return null; |