Created
December 22, 2016 03:07
-
-
Save zentrope/181d591b52dcf3f5d336bc15131a1116 to your computer and use it in GitHub Desktop.
A comma for thousands separator in Clojurescript using goog closure libs.
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
(ns client.ui | |
(:require | |
[goog.i18n.NumberFormat.Format]) | |
(:import | |
(goog.i18n NumberFormat) | |
(goog.i18n.NumberFormat Format))) | |
(def nff | |
(NumberFormat. Format/DECIMAL)) | |
(defn- nf | |
[num] | |
(.format nff (str num))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks great. I had a similar solution in mind. Tried all the format patterns!