Stuck with std.algorithm.splitter

Aleksandar Ružičić ruzicic.aleksandar at gmail.com
Sun Apr 3 17:19:56 PDT 2011


I definitely must sit down and read about ranges, as it seems I don't
quite get what exactly they are (and what types of ranges exists and
the difference between them)..

>
> auto parts = array(splitter(input, '|'));
>

That's a nice solution! I wasn't aware of array() though..
But I would like to avoid coping the data in this situation (I'm just
interested in reading first one or two elements) so I'll be using
explode() function I posted in previous email.

Btw, I think that std.string could use function like this (explode,
with possibly additional parameter to limit number of elements). At
least by me, it's very commonly used function...

> Then you'll have an array of strings to use. That _does_ copy the data though,
> so it's not something that you'd generally want to do if all you're doing is
> iterating through the result of splitter.
>
> - Jonathan M Davis
>


More information about the Digitalmars-d-learn mailing list