April 04, 2006 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 |
Copyright © 1999-2021 by the D Language Foundation