Class String.SplitIterator (< StringType >)

Inheritance graph
Iterator String.SplitIterator
Description

An iterator that iterates over substrings of a string, separated by a character or several different characters.

Note

Typically you don't need to explicitly use the SplitIterator. Expressions like the following are automatically optimized into using a SplitIterator.

foreach(str/"\n", string line)
      write("%s\n", line);

Generic StringType

__generic__ string StringType = string


Inherit predef::Iterator

inherit Iterator : predef::Iterator


Method create

String.SplitIterator String.SplitIterator(StringType buffer, int|array(int)|multiset(int) split_set, int|void flags, function(:StringType|zero)|void feed)

Parameter buffer

The string to split.

Parameter split_set

The character or characters to split on.

Parameter flags

Skip empty elements if set.

Parameter feed

Callback function that is called once the buffer is used up and the SplitIterator wants more data.