Revision: 5064
Updated Code
at February 8, 2008 09:37 by pmatrasc
Updated Code
public static String getFileExtension(String fileName) { File tmpFile = new File(fileName); tmpFile.getName(); int whereDot = tmpFile.getName().lastIndexOf('.'); if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2 ) { return tmpFile.getName().substring(whereDot+1); } return ""; }
Revision: 5063
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 8, 2008 09:07 by pmatrasc
Initial Code
public static String getFileExtension(String fileName) { File tmpFile = new File(fileName); tmpFile.getName(); int whereDot = tmpFile.getName().lastIndexOf('.'); if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2 ) { return tmpFile.getName().substring(0, whereDot+1); } return ""; }
Initial URL
blog.paolomatrascia.com
Initial Description
Initial Title
Extract the extension of a file from a full pathname
Initial Tags
file, files, extension
Initial Language
Java