Consider (and this time there is no subsequent question!):
// {20120404}
include "consolewindow"
begin globals
dim as str255 gC1,gField
dim as short pPos
end globals
gC1 = "1234p23r876s986p2r987s876p654r432s44p11r22s33p44t44r55s66p77r88s99p234"
print gC1
local fn GetOneVal as str255//gets here with header
dim as short LPos
dim as str255 LField
gC1 = mid$(gC1,2)//header gone
LPos = 0
do//find next header
LPos ++
until gC1[LPos] > asc("9")
LField = mid$(gC1,1,Lpos-1)//fish out the number
gC1 = mid$(gC1,LPos)//get rid of all the digested stuff
end fn = LField
do
pPos = 0
do
pPos ++
until gC1[pPos] > asc("9")
select pPos
case >1//doesn't start with a header
gC1 = right$(gC1,len(gC1)-pPos+1)
case =1//starts with a header
select gC1[1]
case = asc("p")
print "P ";
gField = fn GetOneVal
print gField
case = asc("r")
print "R ";
gField = fn GetOneVal
print gField
case = asc("s")
print "S ";
gField = fn GetOneVal
print gField
case = asc("t")
Print "T ";
gField = fn GetOneVal
print gField
case else
print gC1[1]
end select
case else
print "pPos" = ";pPos
end select
until len(gC1) < 5
print "Leftover - ";gC1
**
Thanks all around! What a crew you are!
t