Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact
/*******************************************************************************

        Split text on a set of delimiters

*******************************************************************************/

import tango.io.Console;
import Text = tango.text.Util;

void main()
{
        string source = "one#two@three";

        // split into an array
        string[] elements = Text.delimit (source, "#@");
        foreach (element; elements)
                 Cout(element).newline;

        // incremental alternative with no heap activity
        foreach (element; Text.delimit (source, "#@"))
                 Cout(element).newline;
}