proc/splittext(txt as text, sep as text)
var
list/accum
start;end
accum = new/list()
start = 1
do
end = findtext(txt,sep,start)
accum += copytext(txt,start,end)
start = end + lentext(sep)
while(end)
return accum
Create text from list lst, using sep to separate the elements:
proc/joinlist(list/lst,sep as text)
var
txt as text
i
txt = lst[1]
for(i=2,i<=lst.len,i++)
txt = addtext(txt,sep,lst[i])
return txt
Enjoy!
edit: changed while() loop to a do while() loop.
You could also make usage of the '.' variable here, such that:
(Just modifying your example)