Bug 4959 – std.conv.parse error "no digits seen" on string starting with zero
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-09-30T06:24:00Z
Last change time
2010-09-30T06:44:00Z
Assigned to
nobody
Creator
bugzilla
Comments
Comment #0 by bugzilla — 2010-09-30T06:24:18Z
Test case:
auto s = "0 ";
auto f = parse!double(s); // std.conv.ConvError: no digits seen
The problem is that when the string starts with '0', parse() skips that char to check if the next one is 'x' (to determine whether it's a hex number). When it is not a hex number, like in the example above, the zero is simply discarded.