Line offset of an item (and other similar functions).

J. Landman Gay jacque at hyperactivesw.com
Mon Jan 24 22:14:42 EST 2005


On 1/24/05 8:45 PM, Alex Tweedly wrote:

> I don't think the standard handlers / libraries / commands can do this 
> for me, but I can always hope I missed it.
> 
> I have a data structure consisting of multiple lines, each of multiple 
> items.
> I want to find the line number which contains a particular item; the 
> item can be at any item position within the line.
> I do want to match only whole items, so as to avoid false positives 
> (i.e. item "alex1" should not match "alex123")
> 
> lineOffset will give me the line number - but there's no way to say 
> "match whole items only"
> itemOffset will find the right instance (given wholeMatches set to 
> true), but it gives me item number, not line number
> matchChunk will find it for me - but gives character positions, not line 
> number
> 
> I'm hoping there's some way to inveigle one of the 'offset' functions to 
> do this.

Like this:

get the number of lines in item 1 to itemoffset(tString,tData) of tData

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the Use-livecode mailing list