My new least favorite one-liner...

Dejan Lekic dejan.lekic at gmail.com
Mon Nov 7 06:04:22 PST 2011


Regan Heath wrote:

> You've also got std.ascii.digits which is "0123456789" and
> std.string.digits which is an alias of it, so you can say:
> 
> import std.ascii; (or std.string)
> 
> int x = 5;
> char c = std.ascii.digits[x];
> 

I used similar solution to bearophile's before. I must admit i did not know 
about std.ascii.digits[], thanks for the info Regan.


More information about the Digitalmars-d-learn mailing list