Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Tokenize-a-string/SNOBOL4/tokenize-a-string.sno
Normal file
17
Task/Tokenize-a-string/SNOBOL4/tokenize-a-string.sno
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue