Usage:
list$ = SPLIT$(
string$,
delimiter$ )
DEF SPLIT$(S$,D$)
VAR LD%=LEN(D$)
DIM R$[1]
VAR N%=INSTR(S$,N%)
IF N%==-1 THEN
R$[0]=S$
RETURN R$
ENDIF
R$[0]=LEFT$(S$,N%)
@L
VAR L%=N%+LD%
N%=INSTR(L%,S$,D$)
IF N%!=-1 THEN
PUSH R$,MID$(S$,L%,N%-L%)
GOTO @L
ENDIF
PUSH R$,MID$(S$,L%,&H7FFFFFFF)
RETURN R$
END
Ex:
DIM A$[0]
A$ = SPLIT$("A**B**C","**")
?A$[1] 'B
(this could be much shorter but I wrote it a long time ago to be as fast as possible. If you want something faster to type but slightly less efficient you can use:
DEF SPLIT$(S,D)
S=S+D
DIM L$[0]
@L
VAR J,I=INSTR(J,S,D)
IF I>=0 THEN PUSH L$,MID$(S,J,I-J):J=I+1:GOTO@L
RETURN L$
END
(this is also not completely reliable with delimiters longer than 1 character)