split

Split s[] into an array of strings, using the regular expression pattern as the separator.

  1. string[] split(string s, RegExp pattern)
    string[]
    split
    (
    string s
    ,)
  2. string[] split(string s, string pattern, string attributes)

Parameters

s string

String to search.

pattern RegExp

Regular expression pattern.

Return Value

Type: string[]

array of slices into s[]

Examples

foreach (s; split("abcabcabab", RegExp("C.", "i")))
{
    writefln("s = '%s'", s);
}
// Prints:
// s = 'ab'
// s = 'b'
// s = 'bab'

Meta