Anonymous user
Tokenize a string: Difference between revisions
→{{header|Logo}}
(add m4) |
|||
Line 370:
output parse map [ifelse ? = :sep ["| |] [?]] :str
end</lang>
This form is more robust, doing the right thing if there are embedded spaces.
<lang logo>
to split :str :by [:acc []] [:w "||]
if empty? :str [output lput :w :acc]
ifelse equal? first :str :by ~
[output (split butfirst :str :by lput :w :acc)] ~
[output (split butfirst :str :by :acc lput first :str :w)]
end
</lang>
<lang logo> ? show split "Hello,How,Are,You,Today ",
|