Skip to content

Instantly share code, notes, and snippets.

@drewbo
Forked from mihi-tr/ZeroPad.clj
Created August 22, 2014 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewbo/7cacca4678c2e6c18b65 to your computer and use it in GitHub Desktop.
Save drewbo/7cacca4678c2e6c18b65 to your computer and use it in GitHub Desktop.
(defn zp "Zero Pad numbers - takes a number and the length to pad to as arguments"
[n c]
(loop [s (str n)]
(if (< (.length s) c)
(recur (str "0" s))
s)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment