Does string.isNumeric mean that parse!int will not throw?

Stanislav Blinov stanislav.blinov at gmail.com
Thu Feb 20 11:18:14 PST 2014


On Thursday, 20 February 2014 at 19:11:55 UTC, Cooler wrote:
> The code:
>
> string s = "...";
> if(s.isNumeric){
>     auto x = parse!int(s); // Can I be sure here that parse will
> not throw?
> }

No. s may still contain data that is not convertible to int. For
example, "nan".


More information about the Digitalmars-d-learn mailing list