Char position of token...

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


On 11/22/05 3:48 PM, "Jeanne A. E. DeVoto" <revolution at jaedworks.com> wrote:

> Try something like this:
> 
>    put offset(token 5 of temp,temp) -- gives position of first char of token 5
>    put offset(token 6 of temp,temp) - 1 -- gives position of last char
> of token 5


Unfortunately this won't work for some tokens, or when there's more than one
of the same token in a string, like:

  put word 1 of (word 2 to 4 of the uProp of this card)

and we're looking for the second "word" token. Also some tokens have a space
before them, so doing -1 on the offset should be -2 (or some trimming should
take place).

However for the math formula presented, these should work fine, but just be
aware if you want to make it more general purpose.


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