develooper Front page | perl.perl5.porters | Postings from February 2013

[perl #84680] POSIX::isdigit() returns 1 for the empty string

Thread Next
From:
James E Keenan via RT
Date:
February 5, 2013 03:10
Subject:
[perl #84680] POSIX::isdigit() returns 1 for the empty string
Message ID:
rt-3.6.HEAD-27190-1360033808-1121.84680-15-0@perl.org
On Fri Feb 25 11:34:59 2011, stmpeters wrote:
> On Fri, Feb 25, 2011 at 1:16 PM, Abigail <abigail@abigail.be> wrote:
> 
> > On Fri, Feb 25, 2011 at 06:03:54PM +0100, Leon Timmermans wrote:
> > > On Fri, Feb 25, 2011 at 5:52 PM, Abigail <abigail@abigail.be>
> wrote:
> > > > Is there a reason the description uses vague terms like "digits
> range",
> > > > instead of 0-9?
> > >
> > > Because according to POSIX �The isdigit() function shall test
> whether
> > > c is a character of class digit in the program's current locale�.
> > >
> >
> >
> > But surely, something like "digits 0-9 (unless your locale defines
> other
> > digits)" or "digits 0-9 (or what is defined by your locale)" is
> clearer?
> > Many people don't use locales, or don't even know what they are -
> does it
> > hurt to mention the general case first, and be explicite about the
> > exception
> > instead of using a phrase that will leave many puzzled (and many to
> assume
> > something else than intended)?
> >
> >
> >
> > Abigail
> >
> 
> It certainly never hurts to clarify.  I'll clear that up as well.
> 
> Steve Peters
> steve@fisharerojo.org


ext/POSIX/lib/POSIX.pod currently states with respect to 'isdigit':

#####
=item isdigit

This is identical to the C function, except that it can apply to
a single character or to a whole string.  Note that locale settings
may affect what characters are considered C<isdigit> (unlikely, but
still possible). Does not work on Unicode characters code point 256
or higher.  Consider using regular expressions and the C</[[:digit:]]/>
construct instead, or the C</\d/> construct.
#####

Is that sufficient to resolve the issues raised in this RT and enable us
to close this ticket?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=84680

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About