List of utility methods to do File Extension Name Get
String | getFileExtension(String fileName) get File Extension String ext = null; int k = fileName.lastIndexOf(EXTENSION_SEPARATOR); if (k != -1) { ext = fileName.substring(k + 1, fileName.length()); return ext; |
String | getFileExtension(String fileName) Get File extension (result will NOT include ".") int posExt = fileName.lastIndexOf("."); return posExt == -1 ? "" : fileName.substring(posExt + 1); |
String | getFileExtension(String fileName) Returns the extension of the given file without leading dot symbol. fileName = new File(fileName).getName(); int dotIndex = fileName.lastIndexOf('.'); if (dotIndex == -1) { return ""; return fileName.substring(dotIndex + 1); |
String | getFileExtension(String filePath) Returns the file extension of file {Category} FileUtil {param} string(filePath) fullPath: String. File f = new File(filePath); String name = f.getName(); int pos = name.lastIndexOf('.'); if (pos >= 0 && pos < name.length() - 1) { return name.substring(pos + 1); } else { return ""; |
String | getFileExtension(String filePath) get File Extension if (filePath == null || filePath.trim().length() == 0) { return filePath; int extenPosi = filePath.lastIndexOf("."); int filePosi = filePath.lastIndexOf(File.separator); if (extenPosi == -1) { return ""; return (filePosi >= extenPosi) ? "" : filePath.substring(extenPosi + 1); |
String | getFileExtension(String filePath) Get file extension String extension = ""; String fn = new File(filePath).getName(); if (fn.contains(".")) { String ext = filePath.substring(filePath.lastIndexOf(".") + 1).toLowerCase().trim(); try { extension = ext; } catch (IllegalArgumentException e) { return extension; |
String | GetFileExtension(String fname) Get File Extension for (int i = fname.length() - 1; i >= 0; i--) { if ((fname.charAt(i) == '.') && (i != fname.length() - 1)) { return fname.substring(i + 1); if (fname.charAt(i) == File.separatorChar) { return ""; return ""; |
String | getFileExtension(String name) get File Extension int iIndex = name.lastIndexOf('.'); if (iIndex >= 0) { return name.substring(iIndex); return null; |
String | GetFileExtension(String path) Get File Extension String extension = ""; if (path != null && path.length() > 0) { int idx = path.lastIndexOf('.'); if (idx >= 0) { int lastSlashIdx = path.lastIndexOf(java.io.File.separatorChar); if (idx > lastSlashIdx) { extension = path.substring(idx + 1); return extension; |