Something like charIndex, but in a variable...
Alex Tweedly
alex at tweedly.org
Thu Apr 30 18:26:09 EDT 2015
Not quite so straightforward, but you can do
function getCharIndexByLineToken pVar, pLine, pToken
local temp
put the number of chars in line 1 to (pLine-1) of pVar into temp
add 1 to temp -- for the CR between lines 14 and 15 !!
add the number of chars in token 1 to (pToken-1) of line 15 of pVar
to temp
return temp
end getCharIndexByLineToken
Unfortunately you need different functions for token, word, etc. unless
you want to make it more complex and (probably) need to use "do" or "value"
Hmmm - and maybe you need to watch that "add 1" in the case of pLine
being 1 !!
or beyond the end ?!?
-- Alex.
On 30/04/2015 09:07, Malte Brill wrote:
> Hi all,
>
> I need to find the start and end character of chuncks in a variable. If we are in a field we can use charIndex for that. However, in a variable I have no good idea on how to do something similar to
>
> get charIndex(token 7 of line 15 of field myField)
>
>
> Any ideas?
>
> All the best,
>
> Malte
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list