FUNCTION Split(a$,b$) As Integer' returns the number of dimensions in SP$ always starts from 1 regardless of OPTION BASE LOCAL INTEGER z,n,m IF b$="" then Split=0:EXIT FUNCTION ' can't split with an empty delimiter ' if SP$ doesn't exist, the ERASE will cause an error, choose which ON ERROR SKIP you need 'MM.Ver <5.04 ON ERROR SKIP 'MM.Ver >=5.04 ON ERROR SKIP 1 ERASE SP$ z=1:n=0 DO 'count instances of delimiter for DIM SP$() z=INSTR(z,a$,b$) IF z=0 THEN IF n=0 THEN ' no delimeters DIM SP$(1):SP$(1)=a$:Split=1:EXIT FUNCTION ' only one substring ELSE EXIT DO END IF ELSE n=n+1:z=z+LEN(b$) END IF LOOP m=n+1:n=1 DIM SP$(m) DO z=INSTR(1,a$,b$) IF z=0 THEN SP$(m)=a$:EXIT DO ELSE SP$(n)=LEFT$(a$,z-1):a$=MID$(a$,z+LEN(b$)):n=n+1 END IF LOOP Split=m END FUNCTION