Ever since HC days, the workings of the “find command, that is, each “find”
remembers its container location, can be exploited. Assuming you have multiple
instances of the string “bbb” in a container (in this example, a field 1):
on mouseUp
repeat while the result is empty
find "bbb" in fld 1
put word 2 of the foundLine & return after tLinesFound
end repeat
answer tLinesFound
end mouseUp
Craig
> On Oct 9, 2026, at 9:03 AM, Mike Kerner via use-livecode
> <[email protected]> wrote:
>
> have you tried using regex for this? it should be blazing fast.
>
> On Fri, Oct 9, 2026 at 3:41 AM jbv via use-livecode <
> [email protected]> wrote:
>
>> Hi list,
>>
>> When lineoffset returns a value greater than 0, that
>> means the string to search has been found.
>> But is there a way to get the content of the found line ?
>>
>> Of course, I can use :
>> get lineoffset(myVar,myList)
>> if it > 0 then
>> put line it of myList into tline
>> end if
>>
>> But when myList is very long, and when many lines are
>> successively found, the script has to count the lines
>> each time and it becomes very slow.
>>
>> There is also the option to split the lines of myList
>> into an array :
>> put myList into Tlist using return
>> get lineoffset(myVar,myList)
>> if it > 0 then
>> put Tlist[it] into tline
>> end if
>>
>> But then again, splitting the list can be slow if it's
>> very long.
>>
>> IMHO it would be a great improvement to get the content
>> of the line in which the string to search has been found.
>> For instance, if nothing has been found, the returned value
>> would still be zero.
>> And if the string to search has been found, the returned
>> value could be as follows :
>> line 1 -> the line number
>> line 2 -> the content of the found line
>>
>> Best,
>> jbv
>>
>> _______________________________________________
>> use-livecode mailing list
>> [email protected]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
> and did a little diving.
> And God said, "This is good."
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode