Java how get filename and/or extension

Its very easy to do with the help of Apache commons IO FilenameUtils. Please download the jar file from the Apache commons IO website - http://commons.apache.org/io/
String filenamewithExtension = "filename.ext";
String justFilename = FilenameUtils.removeExtension(filenamewithExtension);
String extension = FilenameUtils.getExtension(filenamewithExtension); 

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.