Splitter quiz / survey
Georg Wrede
georg.wrede at iki.fi
Sun Apr 26 23:43:04 PDT 2009
Brad Roberts wrote:
> Without looking at the docs, code, or compiling and running a test, what will
> this do:
>
> foreach(x, splitter(",a,b,", ","))
> writefln("x = %s", a);
>
> I'll make it multiple choice:
>
> choice 1)
> x = a
> x = b
>
> choice 2)
> x =
> x = a
> x = b
>
> choice 3)
> x = a
> x = b
> x =
>
> choice 4)
> x =
> x = a
> x = b
> x =
Ehhh, one would /hope/ it's 4.
Of course, if you're making a fancy library, then the bells-and-whistles
version might contain a way to parameterize, so that it can "skip"
superfluos commas at the beginning and/or end. But that might be overkill.
More information about the Digitalmars-d
mailing list