Distinguish float and integer types from string
XavierAP
n3minis-git at yahoo.es
Mon Mar 11 15:07:59 UTC 2019
On Monday, 11 March 2019 at 15:03:39 UTC, XavierAP wrote:
>
> What compiler version are you using? I on the other hand was
> surprised that I needed the try-catch above, after having
> already checked isNumeric. The documentation claims that the
> conversion to int or long would truncate, but my compiler
> (v2.084.0) throws instead.
Of course now I realize that using try-catch I no longer need to
check isNumeric... My design didn't use try-catch but I had to
add it because std.conv:to behaves differently from the
documentation:
https://dlang.org/phobos/std_conv.html#to
Not sure if I need to update my DMD, or it's the documentation
that's out of date, or something else is wrong.
More information about the Digitalmars-d-learn
mailing list