lineOffset wildcard

Ken Ray kray at sonsothunder.com
Mon Apr 19 16:02:59 EDT 2021


> On Apr 19, 2021, at 1:47 PM, Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> On 4/19/21 11:04 AM, J. Landman Gay via use-livecode wrote:
> 
>> I don't think lineoffset supports wildcards, but you could do it with matchChunk.
> 
> Ah! matchChunk and the the number of lines of... etc...
> That should do it.

Another way to do it is to use 'filter' to get the text of the line that matches your wildcard, and then 'lineOffset' to find that line:

put tScript into tTemp
filter tTemp with ("local*" & tFunctionName & "*")
put lineOffset((cr & tTemp & cr),(cr & tScript & cr)) into tPos

Not sure if 'filter' is faster than 'matchChunk' when dealing with large scripts, but I have a feeling it might be...


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Website: https://www.sonsothunder.com







More information about the use-livecode mailing list