numericValue for (unicode) characters

bearophile bearophileHUGS at lycos.com
Wed Jan 2 19:14:28 PST 2013


Dmitry Olshansky:

> Yup, and it's 2 lines then. And if one really wants to chain it:
> map(a => enforce(std.ascii.isNumeric(a)), a -= '0')(...);
>
> Hardly makes it Phobos candidate then ;)

I think you meant to write:

map(a => enforce(std.ascii.isNumeric(a)), a - '0')(...);

To avoid some bugs I try to not use the comma expression like 
that.

Compare that code with:

map!numericValue(...);

Bye,
bearophile


More information about the Digitalmars-d mailing list