LineOffset

Alex Tweedly alex at tweedly.net
Mon Mar 28 11:39:16 EST 2005


Yves COPPE wrote:

> Hello,
>
>
> I search a function to do the following :
>
>
> A text contains lines. each line begins with a date "JJ/MM/AAAA" and 
> then a tab and the a ascii text
> Id like to find the line which contains the date
>
> 28/03/2005 tab ascii text
> 25/03/2005 tab ascii text
> 21/03/2005 tab ascii text
> 20/03/2005 tab ascii text
>
>
>
> for example put lineoffset("28/03/2005",tdata) into thisLine
>
> it's OK BUT
>
> I'd like to find the line which item 1 (itemdel to tab) is this date 
> and not the line which contains this date, because in the ascii text 
> following the tab, there are also dates and those dates could be the 
> searched date
>
> I only want to find the line which begins with the searched date

As luck would have it, Chipp just recently forwarded a great tip from 
Ken Ray, which can be adapted to suit here  ....

> put lineOffset(cr & "28/03/2005",cr & tList)
>
> The first cr makes sure the line you're looking for starts with your 
> date and the second one is used to 'sync' up the number you're returning. 

Or, if you know that the ascii text will *not* contain TABs, you could do
lineOffset("28/03/2005" & TAB, tdata)

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005



More information about the use-livecode mailing list