to find the first numeric line?

dunbarx at aol.com dunbarx at aol.com
Fri Feb 1 18:52:50 EST 2013


Ah.


I had thought "filter" deleted the specified characters in a string, not that it loses lines containing those characters directly. I think I knew that once.


Live and re-learn.




Craig





From: Jim Lambert <jiml at netrin.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Fri, Feb 1, 2013 6:10 pm
Subject: Re: to find the first numeric line?


Craig wrote:

> But there is a problem in that much, if not all of his data is both alpha and 
numeric, like "A2"
> So filtering will not eliminate those lines that contain strings in that form.
> 

Works on this:
1a
1b
a1
a2b4
3t
c7
5u
h2
5k

Give it a shot.

JimL

> Mark wrote:
> 
>> have you taken a look at the FILTER command?
>> filter list with "[1-9]*"
> 
> That is a possible approach, like this:
> 
> function getNumericLineStart temp
>   put the number of lines of temp into totalLines
>   sort numeric temp
>   filter temp with "[1-9]*"
>   put the number of lines of temp into totalLinesNumericStart
>   return totalLines-totalLinesNumericStart
> end getNumericLineStart
> 
> Not sure if this is any speedier than a repeat loop.
> 
> Jim Lambert

_______________________________________________
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