where is the format function

235 views
Skip to first unread message

Yehonathan Sharvit

unread,
Apr 30, 2014, 11:26:40 PM4/30/14
to clojur...@googlegroups.com
It seems that “format” has been removed from cljs.

Also, goog.string.format is not available any more.

My question is: what is the best way to add leading zeros in cljs?

Karel Miarka

unread,
Sep 12, 2016, 10:05:05 AM9/12/16
to ClojureScript
Have you already found the answer? Could you please share it?

Francis Avila

unread,
Sep 12, 2016, 10:46:41 AM9/12/16
to ClojureScript
goog.string.format definitely still exists: http://google.github.io/closure-library/api/goog.string.format.html

goog.string also has many specialized formatting functions. For example, for leading zeros, use goog.string/padNumber:

http://google.github.io/closure-library/api/goog.string.html#padNumber

mars0i

unread,
Sep 12, 2016, 11:22:32 AM9/12/16
to ClojureScript
There's also cljs.pprint/cl-format, which is portable between Clojurescript and Clojure (there as clojure.pprint/cl-format).
Reply all
Reply to author
Forward
0 new messages