function

explode . string . sncode

VERSIONlatest Split a string by string

EXPLODE

NAME

explode - Splits a string by string

SYNOPSIS

(delimiter,str,limit)

DESCRIPTION

 

PARAMETERS

delimiter
The boundary string.
str
The input string.
If the limit is set and is positive, the returned array will contain a maximum of limit elements with the last element containing the rest of string. If the limit parameter is negative, all components except the last -limit are returned. If the limit parameter is zero, then this is treated as being 1.
 
limit

RETURN

Returns an array of strings created by splitting the string parameter on boundaries formed by the delimiter.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

in:  res={_{explode("","test t2 t3");}}.
out: res=["t","e","s","t"," ","t","2"," ","t","3"].

in:  res={_{explode("","test t2 t3",-2);}}.
out: res=["t","e","s","t"," ","t","2"," "].

in:  res={_{explode("","test t2 t3",2);}}.
out: res=["t","est t2 t3"].

in:  res={_{explode(",","a,b,c");}}.
out: res=["a","b","c"].

in:  res={_{explode("t","ttest t2 t3t");}}.
out: res=["","","es"," ","2 ","3",""].

in:  res={_{explode("test","ttest test2 t3t");}}.
out: res=["t"," ","2 t3t"].

AUTHOR

Written by Pusnei Sergey and Caroline Laplante, <sergey@sednove.com>