www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15526] New: ignore underscores for parsing integers


          Issue ID: 15526
           Summary: ignore underscores for parsing integers
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

Currently, to!int("1_234") results in an error, and

auto x = "1_234";
auto y = parse!int(x);

results in y == 1, x == "_234"

However, it would be nice if there was a way that literals in the D sense were
parsed as well as straight C literals.

Liam McSherry created a PR to do this, but it was never fixed/accepted. Most of
the discussion on this issue can be read in the PR comments here:

I believe what we need is a parseDInteger function that can be used as a basis
for other functions.

Jan 07 2016