Sorceress

strsplit

Oct 5th, 2019
212
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. strsplit: ' input a string a$, output an array of tokens w$()
  2. DL$ = " "
  3. FOR i = 1 TO 64: w$(i) = "": NEXT
  4. words = 1: ok = 0: L = LEN(a$)
  5. FOR j = 1 TO L
  6. b$ = MID$(a$, j, 1)
  7. IF b$ = DL$ THEN
  8. IF ok = 1 THEN words = words + 1: ok = 0
  9. ELSE
  10. IF b$ > " " THEN w$(words) = w$(words) + b$: ok = 1
  11. END IF
  12. NEXT
  13. RETURN
RAW Paste Data