Concatenates int
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 10 05:33:44 PDT 2014
Rikki Cattermole:
> int myint = to!int("4" ~ "7" ~ "0" ~ "1");
And to concatenate them there is "join" (joiner is not yet usable
here, because to!() doesn't yet accept a lazy input,
unfortunately).
> Now they are not strings, and the positions of 10^ doesn't
> change then:
>
> int myint = (1000 * 4) + (100 * 7) + 1;
Even if Phobos doesn't yet have a enumerate() function, you can
use a iota+zip+reduce to do this.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list