As long as you know that there are always multiple words and that there is always a space between them, you can do something like this:
mystring$="This string has five words"
firstspace=Instr(mystring," ",1)
firstword$=Left(mystring$,firstspace-1)
restword$=Mid$(mystring$,firstspace+1)
Print "The First:"+firstword
Print "The Rest :"+restword
WaitKey()
(This will also strip the space between the first and second word)
or without using the extra variables, duplicating the string search:
mystring$="This string has five words"
Print "The First word:"+Left(mystring$,Instr(mystring," ",1)-1)
Print "The Rest :"+Mid$(mystring$,Instr(mystring," ",1)+1)
|