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

Alex Tweedly alex at tweedly.net
Mon Jan 24 21:45:26 EST 2005


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.

Alternatively is there some way to convert chunk expressions between 
types, e.g.
given myVar containing

> abc,def,ghi
> 12, 34, 56
> a1,b2,c3,d4

convert an expression such as   item 3 to 5 of myVar  to the 
corresponding char/word/line expression (i.e. char 9 to 17 or word 1 to 
3 or  line 1 to 2). 

Any suggestions on how to do it ?
If I submit an enhancement suggestion - do you think it should be for 
the wholeItemMatch approach or the convert-chunk approach ?

-- Alex.


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.3 - Release Date: 24/01/2005



More information about the use-livecode mailing list