Code:
SUB ParseIt (z AS STRING)'' *******' parse the input: separate words' put words in separate array elements' count it up' ******* ' ' parsing z, super easy ' zLen = LEN(z)' initial value, for sorting through z-string r = 0' initializing value, for sanity maxWord = 31' limit to match words() size FOR a = 1 TO zLen' here we use the length of input string 'z' inClient$ = MID$(z, a, 1)' MID$ magically grabs 1 letter at time and copies it to inClient$ SELECT CASE inClient$' select case uses the single letter to look for something CASE CHR$(33) TO CHR$(173)' printable characters words(r) = words(r) + inClient$' add printable character to the array at 'r' CASE CHR$(32) ' space = new word r = r + 1' increment array location IF r > maxWord THEN r = maxWord' keeps words() from throwing error END SELECT NEXT a' going through the list up to zLen END SUB
Statistics: Posted by nikomaru — Tue Feb 12, 2019 11:37 pm