www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4959] New: std.conv.parse error "no digits seen" on string starting with zero

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4959

           Summary: std.conv.parse error "no digits seen" on string
                    starting with zero
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla kyllingen.net



06:24:18 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 30 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4959


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



06:44:00 PDT ---
http://www.dsource.org/projects/phobos/changeset/2074

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 30 2010