www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - bug in ``isNumeric''

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
Apr 03 2006