String yourfilename = "something.ext";
String[] tokens = yourfilename.split("\\.(?=[^\\.]+$)");
String extension = tokens[1].toLowerCase();
This works even if filename contains multiple dots, however it's not an accurate way of determining a file type.
No comments:
Post a Comment
With great power comes great responsibility