Summary:!int doesn't ignore whitespace
           Product: D
           Version: future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2010-05-09 05:20:45 PDT ---
Too much flexibility in a language and its libs causes several problems, but
the opposite too makes the language and its use fussy. So there is a right
intermediate point of balance to be found.

The conversion from string to numbers performed by is excessively

In Python this conversion works:

>>> int(" 0123\n")

In D v.2.043 the same produces an error:

import std.conv: to;
void main() {
    int x = to!int(" 0123\n");

std.conv.ConvError: Can't convert value ` 0123
' of type const(char)[] to type int

Can be modified to ignore whitespace?
In particular the ending newline is very common, for example every time I want
to convert a line from a text file to a number I have to use something like


Instead of a simpler:


Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to