bug in ``isNumeric''

Boyko Bantchev Boyko_member at pathlink.com
Mon Apr 3 23:59:59 PDT 2006


Hello!

I believe there is a bug in the isNumeric library predicate.
It's description seems to say that it should accept valid
numbers and *not* accept anything else.  Still:

writefln(toString(isNumeric("+")));    // prints ``true''
writefln(toString(isNumeric("-")));    // prints ``true''
writefln(toString(isNumeric("+-")));   // prints ``false''
writefln(toString(isNumeric("-+")));   // prints ``true''
writefln(toString(isNumeric("+.")));   // prints ``true''
writefln(toString(isNumeric("-.")));   // prints ``true''
writefln(toString(isNumeric(".")));    // prints ``true''

The description of isNumeric in
http://www.digitalmars.com/d/phobos/std_string.html
is itself somewhat unclear, perhaps partly because it
contains a non-matched ]-character.

Cheers,
Boyko






More information about the Digitalmars-d-bugs mailing list