Skip to content

Instantly share code, notes, and snippets.

@Ball
Created January 24, 2014 02:43
Show Gist options
  • Save Ball/8591196 to your computer and use it in GitHub Desktop.
Save Ball/8591196 to your computer and use it in GitHub Desktop.
some prefixing logic for some files I'm downloading in a personal project.
(defn zero-pad [n number-string]
(->>
(concat (reverse number-string) (repeat \0))
(take n)
reverse
(apply str)))
(defn prefix [file-name]
(str "ns" (clojure.string/replace file-name #"^\d+" #(pad 3 %))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment