List of utility methods to do File Naked Name Get
String | extractFileNameWithoutExt(String filePath) Extrait un nom de fichier y compris son chemin, mais sans son extension. int idx = filePath.lastIndexOf("."); return (idx > -1) ? filePath.substring(0, idx) : filePath; |
String | extractFileNameWithSuffix(String filePathName) Extract file name (without path but with suffix) from file name with path and suffix. if (filePathName == null) return null; int slashPos = filePathName.lastIndexOf('\\'); if (slashPos == -1) slashPos = filePathName.lastIndexOf('/'); return filePathName.substring(slashPos > 0 ? slashPos + 1 : 0); |
String | extractFileWithoutExtension(String filename) extract File Without Extension try { int cutlen = extractFileExtension(filename).length(); if (cutlen == 0) return filename; return filename.substring(0, filename.length() - cutlen - 1); } catch (Exception e) { return filename; |
String | extractFileWithoutPath(String input) extract File Without Path if (input == null) { return null; } else { int lastSlashPos = Math.max(input.lastIndexOf('/'), input.lastIndexOf('\\')); return (lastSlashPos == -1 ? input : input.substring(lastSlashPos + 1)); |
String | fileNameWithoutExtension(String filename) file Name Without Extension int lastDotIndex = filename.lastIndexOf('.'); char nix_sep = '/'; char win_sep = '\\'; int lastUnixSepIndex = filename.lastIndexOf(nix_sep); int lastWindowsSepIndex = filename.lastIndexOf(win_sep); int lastSepIndex = Math.max(lastUnixSepIndex, lastWindowsSepIndex); int substringIndex = (lastSepIndex > lastDotIndex ? -1 : lastDotIndex); if (substringIndex < 0) { ... |
String | filenameWithoutExtension(String filename) filename Without Extension int pos = filename.lastIndexOf("."); if (pos < 0) { return filename; return filename.substring(0, pos); |
String | getFilenameNoExt(File f) Obtin numele fara extensie String base = null; String s = f.getPath(); int pos = s.lastIndexOf('.'); int min = s.lastIndexOf('/'); if (pos > min && pos < s.length() - 1) { base = s.substring(min + 1, pos); } else return s; ... |
String | getFileNameNoExt(File file) Removes extension from file name String filename = file.getName(); return filename.substring(0, filename.lastIndexOf(".")); |
String | getFileNameNoExt(String path) get File Name No Ext String name = getFileName(path); int p = name.lastIndexOf('.'); if (p == -1) { return name; return name.substring(0, p); |
String | getFileNameNoExtension(File file) Get Filename minus it's extension if present return getFileNameNoExtension(file.getName());
|