|
From: Ethan M. <eam...@gm...> - 2022-06-23 03:26:06
|
On Wednesday, 22 June 2022 18:41:52 PDT Emanuel Berg wrote:
> >> you might want to try "%0'.f" or "%'0.f" (whichever you
> >> find easier to read).
> >
> > What does that apostrophe do?
>
> Grouping. Don't know if that's supported or why it doesn't
> work. But OK.
The thousands separator format is sensitive to the current locale.
I do not know of any way to set is separately; only as one component
of a full numerical locale. Standard US practice does not use a special
character for this purpose, so the standard US locale ignores the aposrophe
in a format. Other locales do provide one, however.
Here is an example of how you can use this in gnuplot:
Script:
A = 1234567.89
set decimal locale 'en_US.UTF-8'
US = sprintf("%'.2f", A)
print "US format is ", US
set decimal locale 'fr_FR.UTF-8'
FR = sprintf("%'.2f", A)
print "FR format is ", FR
Output:
decimal_sign in locale is .
decimal_sign in locale is ,
US format is 1,234,567.89
FR format is 1 234 567,89
Ethan
|