In Java, given a java.net.URL or a String in the form of http://www.example.com/some/path/to/a/file.xml , what is the easiest way to g
java.net.URL
String
http://www.example.com/some/path/to/a/file.xml
I've come up with this:
String url = "http://www.example.com/some/path/to/a/file.xml"; String file = url.substring(url.lastIndexOf('/')+1, url.lastIndexOf('.'));