lineOffset wildcard

Mark Wieder ahsoftware at sonic.net
Mon Apr 19 20:58:51 EDT 2021


On 4/19/21 1:02 PM, Ken Ray wrote:
>> On Apr 19, 2021, at 1:47 PM, Mark Wieder via use-livecode 
>> <use-livecode at lists.runrev.com <mailto: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...

Thanks, Ken.
I'll try benchmarking this against Jacque's suggestion of matchChunk. 
Filter is normally pretty fast, but I'll have to use the regex version, 
and I'm not sure what the speed implications will be.


-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the use-livecode mailing list