[Issue 6925] Thousands grouping syntax in writef?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 7 03:14:11 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=6925

--- Comment #3 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Berni44 from comment #2)
> Meanwhile 
> 
> writef("%.2,f", 1234567.89);
> 
> does this grouping. Result: "1,234,567.89" It does not support a locale
> though. And if I should guess, it will never do, because that would make the
> functions non pure. A possible approach would probably be, to add a special
> module for localization that calls writef and modifies the result according
> to the locale.

A way to keep purity with locales would be to pass the locale into the
functions, e.g.

writef(mylocale, "%.2,f", 1234567.89);

--


More information about the Digitalmars-d-bugs mailing list