From jbv at mozik.fr Fri Oct 9 03:40:51 2026 From: jbv at mozik.fr (jbv at mozik.fr) Date: Fri, 09 Oct 2026 03:40:51 -0400 Subject: lineoffset question In-Reply-To: References: <25cf8f22-ac3c65af-1790179382-215476069892862-2158903@outbound.intercom.littlewheel.com> <344BB923-1617-475C-9FC2-4E5E1DBFF1BF@iotecdigital.com> <1a0d099a3c8.28a4.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> Message-ID: <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> 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 From MikeKerner at roadrunner.com Fri Oct 9 09:03:58 2026 From: MikeKerner at roadrunner.com (Mike Kerner) Date: Fri, 9 Oct 2026 09:03:58 -0400 Subject: lineoffset question In-Reply-To: <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> References: <25cf8f22-ac3c65af-1790179382-215476069892862-2158903@outbound.intercom.littlewheel.com> <344BB923-1617-475C-9FC2-4E5E1DBFF1BF@iotecdigital.com> <1a0d099a3c8.28a4.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> Message-ID: 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 < use-livecode at lists.runrev.com> 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 > 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 > -- 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." From alex at tweedly.net Fri Oct 9 10:32:26 2026 From: alex at tweedly.net (Alex Tweedly) Date: Fri, 9 Oct 2026 15:32:26 +0100 Subject: lineoffset question In-Reply-To: <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> References: <25cf8f22-ac3c65af-1790179382-215476069892862-2158903@outbound.intercom.littlewheel.com> <344BB923-1617-475C-9FC2-4E5E1DBFF1BF@iotecdigital.com> <1a0d099a3c8.28a4.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> Message-ID: <3b185f25-3ff7-484a-8cb9-e7a5ee597239@tweedly.net> Hi, I guess the first question is     do you want the line number as well as the content of the line ? Mike suggested using regex - which is probably fast - but I'm not sure how (if?) it could give you the line number. If you don't need the line number then regex is probably the way to go. If you do, then it may come down to whether > put line it of mylist into tLine > is faster than the regex. I'm afraid I don't like your suggestion of > 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 That would be not backward compatible, so it would break probably 99% of existing uses :-), it would have to be a new function. Alex. On 09/10/2026 08:40, jbv via use-livecode 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 > 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 From craig at starfirelighting.com Fri Oct 9 12:31:19 2026 From: craig at starfirelighting.com (Craig Newman) Date: Fri, 9 Oct 2026 12:31:19 -0400 Subject: lineoffset question In-Reply-To: References: <25cf8f22-ac3c65af-1790179382-215476069892862-2158903@outbound.intercom.littlewheel.com> <344BB923-1617-475C-9FC2-4E5E1DBFF1BF@iotecdigital.com> <1a0d099a3c8.28a4.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> Message-ID: <32D1BE4D-5057-49F2-B20D-574ACF6F255F@starfirelighting.com> 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 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 < > use-livecode at lists.runrev.com> 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 >> 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 >> > > > -- > 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 > 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 From craig at starfirelighting.com Fri Oct 9 13:02:13 2026 From: craig at starfirelighting.com (Craig Newman) Date: Fri, 9 Oct 2026 13:02:13 -0400 Subject: lineoffset question In-Reply-To: <32D1BE4D-5057-49F2-B20D-574ACF6F255F@starfirelighting.com> References: <25cf8f22-ac3c65af-1790179382-215476069892862-2158903@outbound.intercom.littlewheel.com> <344BB923-1617-475C-9FC2-4E5E1DBFF1BF@iotecdigital.com> <1a0d099a3c8.28a4.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> <32D1BE4D-5057-49F2-B20D-574ACF6F255F@starfirelighting.com> Message-ID: <2271280E-B124-49AB-A67E-0F12D3B9B8C7@starfirelighting.com> I recall that somewhere there is a command that covers finding a string in a container such as a variable,Something like “revFind…” Does anyone recall such a thing? It would likely make the handler published just below faster. > On Oct 9, 2026, at 12:31 PM, Craig Newman wrote: > > 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 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 < >> use-livecode at lists.runrev.com> 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 >>> 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 >>> >> >> >> -- >> 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 >> 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 > From alex at tweedly.net Fri Oct 9 16:41:54 2026 From: alex at tweedly.net (Alex Tweedly) Date: Fri, 9 Oct 2026 21:41:54 +0100 Subject: lineoffset question In-Reply-To: <32D1BE4D-5057-49F2-B20D-574ACF6F255F@starfirelighting.com> References: <25cf8f22-ac3c65af-1790179382-215476069892862-2158903@outbound.intercom.littlewheel.com> <344BB923-1617-475C-9FC2-4E5E1DBFF1BF@iotecdigital.com> <1a0d099a3c8.28a4.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> <121e92bce10706fb7e4d9b20fe9edd1c@mozik.fr> <32D1BE4D-5057-49F2-B20D-574ACF6F255F@starfirelighting.com> Message-ID: note that for the jbv's case, we need to use the 'string' variant of find in case there are spaces etc. in the string to be found.    set the text of fld Fhidden to myList    find string myvar in fld Fhidden    put the foundline ..... Also, dictionary says that the "offset" functions are generally faster than the "find" command, and note that you would still need to do something like 'put line x of myList into tLine', so I'm not sure there's much saving from using find rather than a loop with "lineoffset + linestoskip" - even if  we do remember or find the name of the revFind... function. Alex. On 09/10/2026 17:31, Craig Newman via use-livecode wrote: > 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 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 < >> use-livecode at lists.runrev.com> 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 >>> 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 >>> >> >> -- >> 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 >> 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 > _______________________________________________ > 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