Created
January 24, 2014 02:43
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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