Type conversion to string using a custom format.
Type conversion to string using a custom format.
(double-to-str value digits)
Formats a string from a floating-point number. Value is converted to string with the number of decimal places equal to digits. Formatting is independent from locale with point used as decimal separator. Returns string in the floating-point format: +-?[0-9]+
(require '[utilities.format :refer :all])
(double-to-str 1.9 4)
=> "1.9000"
(double-to-str -45.688 2)
=> "-45.69"
(double-to-str +45.688 2)
=> "45.69"
Formats a string from a floating-point number. Value is converted to string with the number of decimal places equal to digits. Formatting is independent from locale with point used as decimal separator. Returns string in the floating-point format: [+-]([0-9]*[.])?[0-9]+ ## Usage (require '[utilities.format :refer :all]) (double-to-str 1.9 4) => "1.9000" (double-to-str -45.688 2) => "-45.69" (double-to-str +45.688 2) => "45.69"
cljdoc builds & hosts documentation for Clojure/Script libraries
Ctrl+k | Jump to recent docs |
← | Move to previous article |
→ | Move to next article |
Ctrl+/ | Jump to the search field |