Tuesday, June 24, 2014

How do I get the file extension of a file in Java?

In this case, use FilenameUtils.getExtension from Apache Commons IO
Here is an example of use:
String ext = FilenameUtils.getExtension("/path/to/file/foo.txt");
http://stackoverflow.com/questions/3571223/how-do-i-get-the-file-extension-of-a-file-in-java

No comments:

Post a Comment