(phixonline)-->
function tokenize(string s, integer sep, integer esc)
sequence ret = {}
string word = ""
integer skip = 0
if length(s)!=0 then
for i=1 to length(s) do
integer si = s[i]
if skip then
word &= si
skip = 0
elsif si=esc then
skip = 1
elsif si=sep then
ret = append(ret,word)
word = ""
else
word &= si
end if
end for
ret = append(ret,word)
end if
return ret
end function
?tokenize("one^|uno||three^^^^|four^^^|^cuatro|",'|','^')