SYNOPSIS
string * explode(string str, string del)
bytes * explode(bytes str, bytes del)
DESCRIPTION
Return an array of strings, created when the string str is split
into substrings as divided by del. When given a byte sequence
returns an array of byte sequences in a similar fashion.
implode(explode(str, del), del) == str is always true.
EXAMPLES
function returns
-------------------------------------------------------------------
explode(" ab cd ef ", " ") ({ "", "ab", "cd", "ef", "" })
explode("abc", "abc") ({ "", "" })
explode("", "") ({ "" })
explode("", <whatever>) ({ "" })
explode("abc", "xyz") ({ "abc" })
explode("abc", "") ({ "a", "b", "c" })
HISTORY
Date of change is unknown.
explode(" ab cd ef ", " ") formerly returned ({ "ab", "cd", "ef" })
instead of ({ "", "ab", "cd", "ef", "" }), i. e. the empty strings
were ignored. The new behaviour is more consistent, because now
implode(explode(str, del), del) == str is always true.
Since 3.5.0 explode("","") returns ({""}), so it is guaranteed to
return a non-empty array.
SEE ALSO
sscanf(E), extract(E), implode(E), regexplode(E)
|