D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4959 - std.conv.parse error "no digits seen" on string starting with zero
Summary: std.conv.parse error "no digits seen" on string starting with zero
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 06:24 UTC by Lars T. Kyllingstad
Modified: 2010-09-30 06:44 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Lars T. Kyllingstad 2010-09-30 06:24:18 UTC
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.
Comment 1 Lars T. Kyllingstad 2010-09-30 06:44:00 UTC
http://www.dsource.org/projects/phobos/changeset/2074