to find the first numeric line?
Peter Haworth
pete at lcsql.com
Fri Feb 1 12:00:13 EST 2013
Hi Tiemo,
Apologies for not testing the code I sent you. It turns out that lineIndex
can only address the contents of a field, not a variable. That seems quite
shortsighted to me, but that's the way it is.
That may make it unusable for your purposes but, for the record, I ran the
same test as you and it took 26 milliseconds to get the line number,
including however long it takes to execute the answer command.
I also tried it with the first qualifying line being the last one, 32768 in
my case, and it took 41 milliseconds,
I'm just learning about regular expressions and they really are very useful
in the right circumstances,
Pete
lcSQL Software <http://www.lcsql.com>
On Fri, Feb 1, 2013 at 1:28 AM, Tiemo Hollmann TB <toolbook at kestner.de>wrote:
> Hi all,
> LC 5.5.3. I made some tests with time stamps, where the first line
> beginning with a number was at about line 18,000:
> The classic cycle thru like Craig's and Bert's took +/- 8 msec
> Iterating by halves to +/- 28 msec
> Peters approach with matchchunk and lineIndex I didn't got to run (some
> execution error on lineIndex, I don't know)
>
> So the good old pure repeat loop is still the best
> Thanks for ideas
> Tiemo
>
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im
> Auftrag
> > von dunbarx at aol.com
> > Gesendet: Freitag, 1. Februar 2013 05:45
> > An: use-livecode at lists.runrev.com
> > Betreff: Re: to find the first numeric line?
> >
> > Just so, and his data was alphanumeric. After sorting, he wanted to find
> > the first line that had a digit as char 1. Since alpha sorts before
> > numbers, he wanted to find the line number where a transition, for
> example,
> > might have been:
> >
> >
> > a1
> > a2
> > 1a --this line
> > 1b
> >
> >
> > The old fashioned way may have been the best, especially with "repeat for
> > each..."
> >
> >
> > Craig Newman
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Robert Sneidar <slylabs13 at me.com>
> > To: How to use LiveCode <use-livecode at lists.runrev.com>
> > Sent: Thu, Jan 31, 2013 11:11 pm
> > Subject: Re: to find the first numeric line?
> >
> >
> > Great idea, but I think he wants to know the line position in the
> string. I
> > could be wrong.
> >
> > Bob
> >
> >
> > On Jan 31, 2013, at 7:59 PM, Mark Stuart wrote:
> >
> > > Hi Tiemo,
> > > I haven’t tried this, but have you taken a look at the FILTER command?
> > > filter list with “[1-9]*”
> > >
> > > Thanx,
> > > Mark Stuart
> > > _______________________________________________
> > > 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
> >
> >
> > _______________________________________________
> > 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
More information about the use-livecode
mailing list