Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: A locale independent sprintf?

by bliako (Prior)
on Jul 29, 2020 at 06:54 UTC ( #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 (Priest) 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
Node Status?
node history
Node Type: note [id://11119941]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2020-10-27 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (256 votes). Check out past polls.

    Notices?