18 lines
562 B
Plaintext
18 lines
562 B
Plaintext
define('split(chs,str)i,j,t,w2') :(split_end)
|
|
split t = table()
|
|
sp1 str pos(0) (break(chs) | rem) $ t<i = i + 1>
|
|
+ span(chs) (break(chs) | '') . w2 = w2 :s(sp1)
|
|
* t<i> = differ(str,'') str ;* Uncomment for CSnobol
|
|
split = array(i)
|
|
sp2 split<j = j + 1> = t<j> :s(sp2)f(return)
|
|
split_end
|
|
|
|
define('join(ch,a)i,') :(join_end)
|
|
join join = join a<i = i + 1>
|
|
join = join ?a<i + 1> ch :s(join)f(return)
|
|
join_end
|
|
|
|
* # Test and display
|
|
output = join('.',split(',','Hello,How,Are,You,Today'))
|
|
end
|