Stuck with std.algorithm.splitter
Aleksandar Ružičić
ruzicic.aleksandar at gmail.com
Sun Apr 3 16:49:27 PDT 2011
Ok, here is my function which works as expected:
---------------------------------------------------------------
string[] explode(in string source, char separator) {
typeof(return) result;
size_t prev = 0;
foreach (i, c; source) {
if (c == separator) {
result ~= source[prev .. i];
prev = i + 1;
}
}
result ~= source[prev .. $];
return result;
}
---------------------------------------------------------------
But, as I sad already, I would really like to use library function..
More information about the Digitalmars-d-learn
mailing list