# Class String.SplitIterator

Inheritance graph

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);

Inherit predef::Iterator

  `inherit Iterator : predef::Iterator`

Method create

  `String.SplitIterator String.SplitIterator(`string` `buffer`, `int`|`array`(`int`)|`multiset`(`int`) `split_set`, `int`|`void` `flags`, `function`(:`string`)|`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.