is there a way to output formatted text following the locale settings ?

someone someone at somewhere.com
Tue May 25 22:37:25 UTC 2021


The following works as expected but the format string will end 
hard-coded:

import std.stdio;
import std.format;

void main (

    ) {

    int intAmount = 1234567;

    writeln(format("%,d", intAmount)); /// eg: 1,234,567

}

I tried something like:

import std.stdio;
import std.format;
import core.stdc.locale;

void main (

    ) {

    setlocale(LC_ALL, "");

    int intAmount = 1234567;

    writeln(format("%`d", intAmount)); /// please, note the 
backtick instead of ,

}

... to no avail :(


More information about the Digitalmars-d-learn mailing list