Skip to content

Instantly share code, notes, and snippets.

@blais
Created September 30, 2010 14:00
Show Gist options
  • Save blais/604609 to your computer and use it in GitHub Desktop.
Save blais/604609 to your computer and use it in GitHub Desktop.
;; FIXME: This is missing from the stdlib.
(defn split-extension [filename]
(let [index (.lastIndexOf filename ".")]
(list (.substring filename 0 index) (.substring filename index))))
(defn get-basename [filename]
(let [index (.lastIndexOf filename ".")]
(.substring filename 0 index)))
(defn get-extension [filename]
(let [index (.lastIndexOf filename ".")]
(.substring filename index)))
(let [s "/sdjsd/sds/djsdsj.txt"]
(map #(% s) (list get-basename get-extension split-extension)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment