I just realized that I read your question incorrectly. You can compile extensions in a similar method, though
String yourString = "/your/whole/path.ext.si.ons"; String[] pathPieces = yourString.split("/"); // [ "your", "whole", "path.ext.si.ons" ] String lastPiece = pathPieces[pathPieces.length - 1]; String[] namePieces = lastPiece.split("."); // [ "path", "ext", "si", "ions" ]
At this point, the first part will probably be your name, where the rest of the parts will be extensions. Then you can join them to have your type of extension.
source share