I've been using this to get the extension:

(defn extension [file]
  (when file
    (let [base (fs/basename file)
          dot (.lastIndexOf ^String base ".")]
      (when (pos? dot)
        (subs base (inc dot))))))

Steve Miner


On Mar 15, 2011, at 5:56 PM, siyu798 wrote:

> Hi Miki,
>   We are planning to use this file system utilities, and we need a function 
> to get file extension. Currently we're using apache common for that, but we 
> want to get rid of apache common altogether.  Can you add this functionality 
> to the fs.clj? Thx
> 
> Si Yu

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to