Formating Numbers

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!

1 Like

Have you tried using @printf?

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

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

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

3 Likes

There is also GitHub - IainNZ/Humanize.jl: Humanize numbers: data sizes, datetime deltas, digit separators

3 Likes