truncating

zero-padding and truncating with string formats in Clojurescript

One of the discrepancies between Clojure and Clojurescript is that the javascript version doesn’t have anything like the classic Unix/C-style string format functions. Some functionality is not simply reproducible with clever uses of str, but fortunately Google Closure is here to save the day. Because Closure is part of Clojurescript, there are no added project dependencies to make this work. (ns myapp.services (:require [goog.string :as gstring] [goog.string.format])) (str "$" (gstring/format "%.