Formating Numbers


#1

I am new in Julia.
Having a Float64 “1.24543123e6” which I want to print as a string in the Format “1,245,431.23” or “1.245.431,23” (de).

I am looking for something like
a) string number_format ( float $number , int $decimals = 0 , string $dec_point = “.” , string $thousands_sep = “,” ) [PHP]
or
b) Java Class Class NumberFormat / DecimalFormat.

Thanks!


#2

Have you tried using @printf?


#3

Yes: @printf("%12.2f\n", x)

but I have no idea how to modify the format-string to do the thausends_seperation.


#4

You may want to use this package: https://github.com/JuliaIO/Formatting.jl


#5

There is also https://github.com/IainNZ/Humanize.jl