Char position of token...

Ken Ray kray at sonsothunder.com
Tue Nov 22 16:37:00 EST 2005


On 11/22/05 3:23 PM, "Gilberto Cuba" <gilbert at isphlg.rimed.cu> wrote:

> Hi,
> then, i need any function that return the follow values:
> 
> token 5 of temp --->  char 7 of temp
> token 3 of temp --->  char 3 to 5 of temp


Here you go, Gilbert:

function stsTokenCharChunk pTokenNum,pData
  put the number of tokens of pData into tNumTokens
  put 0 into tStartOff
  repeat with x = 1 to pTokenNum
    put offset(token x of pData,pData,tStartOff) + tStartOff into tChar
  end repeat
  return "char" && tChar && "to" && \
    (tChar + length(token pTokenNum of pData)-1)
end stsTokenCharChunk

If you don't want it coming back "char 3 to 5" but want it as "3,5" or
something else, just change the last "return" line.

Have fun!

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list