find

yves COPPE yvescoppe at skynet.be
Tue Apr 23 04:07:01 EDT 2002


>You need to use the optional third parameter for lineOffset which 
>tells it how many lines to skip before it starts looking. The trick 
>is to remember that the line number it returns is the line number 
>starting after the skipped lines, so you need to add the two 
>together to get the actual line number.
>
>Here is the function I use. The mouseUp script that calls it assumes 
>your list is in field 1.
>
>on mouseUp
>   put findLines(field 1, "John") into lineList
>   answer lineList
>end mouseUp
>
>function findLines listToSearch, textToFind
>   put empty into foundLines
>   put 0 into startLine
>   repeat
>     put lineOffset(textToFind,listToSearch,startLine) into theLine
>     if theLine = 0 then
>       exit repeat
>     else
>       put (theLine+startLine) & cr after foundLines
>       add theLine to startLine
>     end if
>   end repeat
>   return foundLines
>end findLines
>


Fantastic !
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the use-livecode mailing list