RosettaCodeData/Task/Tokenize-a-string-with-escaping/EasyLang/tokenize-a-string-with-escaping.easy
2024-07-13 15:19:22 -07:00

20 lines
399 B
Text

func$[] tokenize src$ sep$ esc$ .
r$[] = [ "" ]
for i = 1 to len src$
c$ = substr src$ i 1
if esc = 1
r$[$] &= c$
esc = 0
else
if c$ = sep$
r$[] &= ""
elif c$ = esc$
esc = 1
else
r$[$] &= c$
.
.
.
return r$[]
.
print tokenize "one^|uno||three^^^^|four^^^|^cuatro|" "|" "^"