Hi again,
This is a bit quick and dirty but it should help ... its
customized somewhat to your example (no management of bad input or special characters etc) using the pseudocode approach above. You should be able to make it more robust. It runs by itself when copied and executed from DB.
Cheers.
rem declare word array
dim words$(4)
rem declare test string
mycommand$ = "POSITION CHAR 1 100 100"
rem declare looop variables
i=1
n=0
rem start loop
repeat
rem get character from string
ch$=mid$(mycommand$,i)
rem get the ASCII value for the character retrieved
ascval = ASC(ch$)
rem send it to function to return type
kind = det(ascval)
rem test the type in a select statement
select kind
rem creates a string of the letters
case 1: words$(n)= words$(n)+ ch$ :endcase
rem creates a string of the numbers
case 2: words$(n)= words$(n) + ch$:endcase
rem starts a new string
case 3: inc n : endcase
rem safety valve for the function ...
case 0: print "Special character"; " "; ch$ :endcase
endselect
inc i
until (i > len(mycommand$))
rem print out the parsed results
for p = 0 to 4
print words$(p)
next p
rem suspend for user
suspend for mouse
rem we're done
end
rem Returns a value for a character retrived
rem 1 = letter
rem 2 = number
rem 3 = space
function det(ascval)
rem is a letter?
if ((ascval>=65 and ascval=<90) or (ascval>=97 and ascval=<122))
exitfunction 1
endif
rem is a number?
if (ascval>=48 and ascval=<57)
exitfunction 2
endif
rem is a space?
if ascval=32
exitfunction 3
endif
endfunction 0