I need to trim last part of a URL in Clojure. Like I have http://example.com/file.html
and I need to get file.html
out. How to do it in Clojure?
This approach uses the standard library that ships with the JVM, so you don't need any extra libraries:
(-> "http://example.com/file.html" java.net.URL. .getPath java.io.File. .getName)
;;=> "file.html"
See also this question which may be relevant.