Skip to content

Instantly share code, notes, and snippets.

@zentrope
Created December 22, 2016 03:07
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zentrope/181d591b52dcf3f5d336bc15131a1116 to your computer and use it in GitHub Desktop.
Save zentrope/181d591b52dcf3f5d336bc15131a1116 to your computer and use it in GitHub Desktop.
A comma for thousands separator in Clojurescript using goog closure libs.
(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)))
@systemhalted
Copy link

This looks great. I had a similar solution in mind. Tried all the format patterns!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment