lineoffset

Jim Ault jimaultwins at yahoo.com
Fri Nov 6 17:50:26 EST 2009



On Nov 6, 2009, at 1:21 PM, Shao Sean wrote:

> Jim, if I remember correctly from having to do something like this  
> in the past, your solution will not get the first line because it  
> does not start off with the CR from the previous line (unless I am  
> missing something else in this thread in which case, ignore me like  
> my mom does ;-)


The key is to make the IT variable start with a CR in order to include  
only hits at the beginning of a line
and the search text beginning with a CR so that hits can only be true  
at the start of a line.

thus...

get ( cr & the clicktext & "|" )  --string to find

put lineOffset( IT, (cr & fld "storage"))  --text block to search
-- so that the search text begins with a CR and the field does not  
have to
.
--- example text ------------
rainbow| clouds rain sunshine
photo| rain rainbow lightning
image| party balloon cake
balloon| red float photo smile noise

Clicking on any word will get the line number of 0 or > 0.
"rainbow" will = 1, photo = 2, balloon = 4.

Mom says hi.

Jim Ault
Las Vegas



More information about the use-livecode mailing list