Tokenize a string: Difference between revisions

Content added Content deleted
Line 244: Line 244:
;;; If comma
;;; If comma
if str(i) = `,` then
if str(i) = `,` then
;;; Preped word (substring) to list
;;; Prepend word (substring) to list
cons(substring(j, i - j, str), ls) -> ls;
cons(substring(j, i - j, str), ls) -> ls;
i + 1 -> j;
i + 1 -> j;
endif;
endif;
endfor;
endfor;
;;; Preped final word (if needed)
;;; Prepend final word (if needed)
if j <= length(str) then
if j <= length(str) then
cons(substring(j, length(str) - j + 1, str), ls) -> ls;
cons(substring(j, length(str) - j + 1, str), ls) -> ls;