Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: A locale independent sprintf?

by bliako (Monsignor)
on Jul 29, 2020 at 06:54 UTC ( [id://11119941]=note: print w/replies, xml ) Need Help??


in reply to A locale independent sprintf?

After your post I quickly checked and was relieved to find that C's sprintf has not yet been touched by the locale police. phewww. Although I found this:

For some numeric conversions a radix character ("decimal point") or thousands' grouping character is used. The actual character used depends on the LC_NUMERIC part of the locale. (See setlocale(3).) The POSIX locale uses '.' as radix character, and does not have a grouping character.

And also this, which distinguishes between %g and %'g

' For decimal conversion (i, d, u, f, F, g, G) the output is to be grouped with thousands' grouping characters if the locale infor‐ mation indicates any.

Perhaps issue a feature request that Perl follows the same principle. You will do mankind a favour. Unless it does already?

bw, bliako

Replies are listed 'Best First'.
Re^2: A locale independent sprintf?
by swl (Parson) on Jul 29, 2020 at 07:12 UTC

    Looking at the docs for sprintf, perl uses its own implementation of sprintf. There is no mention in it of thousands separators, so I think we're OK on that front.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119941]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-19 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found