digitalmars.D.bugs - [Issue 15526] New: ignore underscores for parsing integers
- via Digitalmars-d-bugs (25/25) Jan 07 2016 https://issues.dlang.org/show_bug.cgi?id=15526
https://issues.dlang.org/show_bug.cgi?id=15526 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: https://github.com/D-Programming-Language/phobos/pull/3377 I believe what we need is a parseDInteger function that can be used as a basis for other functions. --
Jan 07 2016