on Nov 1st, 2016, 01:33am, michael wrote:| I REALLY need a proper tool to interpret my future works |
|
You might be interested in the 'next word' routine that I use in LB Booster:
Code: Alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" testString$ = "Happy Halloween my fellow programmers!!!" REPEAT word$ = FNword(testString$) PRINT word$ UNTIL word$ = "" END DEF FNword(RETURN A$) LOCAL space$ space$ = FNtoken(A$, " ") = FNtoken(A$,Alphabet$) DEF FNtoken(RETURN A$, list$) LOCAL T$ WHILE INSTR(list$, LEFT$(A$,1)) T$ += LEFT$(A$,1) A$ = MID$(A$,2) ENDWHILE = T$
The FNtoken routine returns as much of the supplied string as matches the supplied list of acceptable characters. It is called twice, once to discard leading spaces and then to return the next 'word'. This is quite flexible, for example if you wanted to skip leading tabs as well as spaces ('whitespace') you could do:
Code: whitespace$ = FNtoken(A$, " "+CHR$(9))
and if you want to return a 'variable name' (any letter followed by any combination of letters and numbers) you could do:
Code: variable$ = FNtoken(A$, Alphabet$) + FNtoken(A$, Alphabet$+"0123456789")
Richard.