Re: 12M? or 12 000 000? (not 12000000)

Ethan Merritt <[email protected]> Wed, 22 Jun 2022 20:25:53 -0700
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <2710988.BEx9A2HvPv@stonelion>
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


_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info