Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support printf ' (apostrophe) format flag for builtin commifying #15176

Open
p5pRT opened this issue Feb 12, 2016 · 6 comments
Open

support printf ' (apostrophe) format flag for builtin commifying #15176

p5pRT opened this issue Feb 12, 2016 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 12, 2016

Migrated from rt.perl.org#127521 (status was 'open')

Searchable as RT127521$

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2016

From justincase@yopmail.com

As in C and shell, the ' (apostrophe) format flag is used for​:

  Decimal conversions (d, u, or i) or the integral portion of a
  floating point conversion (f or F) should be grouped and
  separated by thousands using the non-monetary separator
  returned by localeconv(3).

This would make it even easier to perform the common task of commifying numbers.

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

From @jkeenan

On Thu Feb 11 19​:38​:47 2016, justincase wrote​:

As in C and shell, the ' (apostrophe) format flag is used for​:

Decimal conversions (d, u, or i) or the integral portion of a
floating point conversion (f or F) should be grouped and
separated by thousands using the non-monetary separator
returned by localeconv(3).

This would make it even easier to perform the common task of
commifying numbers.

I'm not sure I agree with the feature request, but it would be interesting to learn why Perl differs from C and the shell in this regard.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

From @mauke

Am 13.02.2016 um 02​:49 schrieb James E Keenan via RT​:

On Thu Feb 11 19​:38​:47 2016, justincase wrote​:

As in C and shell, the ' (apostrophe) format flag is used for​:

Decimal conversions (d, u, or i) or the integral portion of a
floating point conversion (f or F) should be grouped and
separated by thousands using the non-monetary separator
returned by localeconv(3).

This would make it even easier to perform the common task of
commifying numbers.

I'm not sure I agree with the feature request, but it would be interesting to learn why Perl differs from C and the shell in this regard.

It doesn't really differ from C. The ' flag is not part of standard C.
(I don't know how common this extension is in practice.)

--
Lukas Mai <plokinom@​gmail.com>

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

From justincase@yopmail.com

On Fri Feb 12 17​:55​:47 2016, plokinom@​gmail.com wrote​:

Am 13.02.2016 um 02​:49 schrieb James E Keenan via RT​:

On Thu Feb 11 19​:38​:47 2016, justincase wrote​:

As in C and shell, the ' (apostrophe) format flag is used for​:

Decimal conversions (d, u, or i) or the integral portion of a
floating point conversion (f or F) should be grouped and
separated by thousands using the non-monetary separator
returned by localeconv(3).

This would make it even easier to perform the common task of
commifying numbers.

I'm not sure I agree with the feature request, but it would be
interesting to learn why Perl differs from C and the shell in this
regard.

It doesn't really differ from C. The ' flag is not part of standard C.
(I don't know how common this extension is in practice.)

I didn't realize it wasn't part of the C standard. Apparently it is defined as an XSI extension [1]. I did verify that it is supported in C on Linux, OS X, FreeBSD, and NetBSD. Other languages supporting it are Bash, Zsh, and awk.

[1] http​://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html

@p5pRT
Copy link
Author

p5pRT commented Jul 3, 2017

From justincase@yopmail.com

On Sat, 13 Feb 2016 14​:46​:31 -0800, justincase wrote​:

On Fri Feb 12 17​:55​:47 2016, plokinom@​gmail.com wrote​:

Am 13.02.2016 um 02​:49 schrieb James E Keenan via RT​:

On Thu Feb 11 19​:38​:47 2016, justincase wrote​:

As in C and shell, the ' (apostrophe) format flag is used for​:

Decimal conversions (d, u, or i) or the integral portion of a
floating point conversion (f or F) should be grouped and
separated by thousands using the non-monetary separator
returned by localeconv(3).

This would make it even easier to perform the common task of
commifying numbers.

I'm not sure I agree with the feature request, but it would be
interesting to learn why Perl differs from C and the shell in this
regard.

It doesn't really differ from C. The ' flag is not part of standard
C.
(I don't know how common this extension is in practice.)

I didn't realize it wasn't part of the C standard. Apparently it is
defined as an XSI extension [1]. I did verify that it is supported in
C on Linux, OS X, FreeBSD, and NetBSD. Other languages supporting it
are Bash, Zsh, and awk.

[1]
http​://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html

According to http​://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html this is now "supported on all POSIX.1-2008-conforming systems."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants