Formats data stored in a string.
Formats data stored in a string.
(to-numeric value)
Changes decimal separator in a string numeric value to a point. It is expected that value matches +-?[0-9]+ where decimal-separator can be any char except [0-9], + and -.
Returns numeric string with point as decimal separator, which matches +-?[0-9]+
(require '[utilities.string-formatter :refer :all])
(to-numeric "123,567") => "123.567"
(to-numeric "-5,89") => "5.89"
(to-numeric "1") => "1"
(to-numeric ",02") => ".02"
(to-numeric "+8,2") => "+8.2"
(to-numeric "-1") => "-1"
(to-numeric "5,") => "5."
(to-numeric "4;5") => "4.5"
Changes decimal separator in a string numeric value to a point. It is expected that value matches [+-]([0-9]*[decimal-separator])?[0-9]+ where decimal-separator can be any char except [0-9], + and -. Returns numeric string with point as decimal separator, which matches [+-]([0-9]*[.])?[0-9]+ ## Usage (require '[utilities.string-formatter :refer :all]) (to-numeric "123,567") => "123.567" (to-numeric "-5,89") => "5.89" (to-numeric "1") => "1" (to-numeric ",02") => ".02" (to-numeric "+8,2") => "+8.2" (to-numeric "-1") => "-1" (to-numeric "5,") => "5." (to-numeric "4;5") => "4.5"
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close