How to get file extension in Java?
I want to get all files with a specific extension. The following code is
working fine.
String extension = "";
int i = fileName.lastIndexOf('.');
if (i > 0) {
extension = fileName.substring(i+1);
}
But, could there be any better way to do?
No comments:
Post a Comment