![](https://seccdn.libravatar.org/avatar/77cb4da5f72bc176182dcc33f03a18f3.jpg?s=120&d=mm&r=g)
On 2018-07-08 13:26, Per Jessen wrote:
Carlos E. R. wrote:
To tell the truth, as a programmer I would not know how to write numbers using the locale.
man printf :-)
Ah, but I use pascal ;-)
"For some numeric conversions a radix character (`decimal point') or thousands' grouping character is used. "
Example:
int main( int argc, char **argv ) { setlocale( LC_NUMERIC, getenv( "KLOP99" ) ); printf("%'.2f", 1234567.89); }
for i in nl_NL.utf8 da_DK.utf8 de_CH.utf8 en_GB.utf8 do KLOP99=$i ./k done
1234567,89 1.234.567,89 1'234'567.89 1,234,567.89
I don't understand what KLOP99 is :-? Not in man printf. The name of the current program? ... No... Ah, a random environment var that you use to pass parameters to the program "k". For the record, when I studied C and later when I programmed in C (msdos and windows) I never saw a mention of this at all.
Normally a programmer just needs to be aware that a locale will be applied on input and output, but she should not need to do anything extra.
If that language and library set do it that way, and depending on the operating system chosen. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar)