Split by length?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Aug 14 20:00:26 PDT 2011


Simplified (and slow) implementation:

T[] splitLength(T)(T arr, size_t count) if (isArray!T)
{
    T[] result;

    while (arr.length)
    {
        result ~= arr.take(count);
        arr.popFrontN(count);
    }

    return result;
}


More information about the Digitalmars-d-learn mailing list