lineoffset and itemoffset alltogether
jbv.silences at Club-Internet.fr
Thu Dec 11 13:33:49 CST 2003
> >I actually meant a Rev built-in function...
> In that case, I venture to say there is none.
Mmh.. that's what I thought...
AFAIR there was a nice feature in OMO (associated
with spreadsheets) : a function that returned the row
& col numbers of a searched string...
I tried to find a workaround. I actually have a variable
that contains a large number of lines, and each line
contains the same number of items. I thought I could
use itemoffset straight (instead of lineoffset) and then
compute the # of the line with a simple calculation.
But things aren't so simple... Here's what I mean :
let's say with have a fld with 2 lines, each line containing
5 items :
if you type "select item 5 of line 1 of fld 1" in the msg box,
"e" will be selected.
"select item 1 of line 2 of fld 1" will select "f".
But if you type "select item 5 of fld 1" then "e" and return
and "f" will be selected.
This is logical (Rev checks the number of itemdelimiters)
but not very handy if you want to quickly calculate which
line the item is in (even if all lines have the same # of items)...
I know that some will ask why I don't use a database.
Yes, that's an option. But the search cmd in Rev is so fast
that when it's only about locating a string in a variable, one
doesn't really feel like bothering with a database...
More information about the use-livecode