Replacement for snprintf

Petar Petar
Wed Nov 6 16:17:32 UTC 2019

On Wednesday, 6 November 2019 at 13:25:38 UTC, berni44 wrote:
> On Thursday, 31 October 2019 at 10:14:59 UTC, Guillaume Piolat 
> wrote:
>> [...]
> Meanwhile, my implementation for the f (and F) qualifier is 
> (almost) finished. Yet, the locale-stuff is missing and I do 
> not manage to implement it. Maybe someone can help me:
> a) I need to create some test. As far as I know, I've to 
> execute "export LANG=de_DE.UTF-8" (in bash, debian) to make it 
> use the german locale, which should replace the dot by a comma. 
> Unfortunately writefln!"%.10f"(0.1) still writes a dot instead 
> of the expected ",". Instead of "LANG" I tried several other 
> stuff, like LC_ALL or LC_NUMERIC. Any idea what I do wrong here?
> b) How to query the current locale from D? Actually I only need 
> the number-separator in the current locale as a dchar. I found 
> core.stdc.locale but do not know how to use it.

I think the best way to go is to make it locale-independent and 
simply provide a way for user to specify the decimal separator 
(and other related locale details, if any).

More information about the Digitalmars-d mailing list