On Tuesday, April 23, 2002, at 04:00 , yves COPPE wrote:

> Hi,
>
> I'd like a script which search for all occurences of a word in a list 
> and returns the number of all lines.
>
>
> an example :
>
> a list with :
>
> Peter
> John
> Richard
> John
> George
> John
> Philip
> Tom
>
> So if i call the code for "John", the result should be :
>
> 2
> 4
> 6
>
>
> I've tried with lineoffset but it gives only the first occurence.

Yves

I noticed in the dictionary that the lineoffset function has an optional 
parameter which is "lines to skip" so I imagine a repeat loop using 
lineoffset and the line number last found (zero to start) would work, 
exiting the repeat loop when the lineoffset returned zero.

Without having tested this code, it could look like

put "John" into JeanMot
put empty into JeanList
put zero into skipSome
put lineOffSet(JeanMot,myList,skipSome) into gotit
repeat while gotit > 0
   put gotit and return after JeanList
   put lineOffSet(JeanWord,aList,skipSome) into gotit
end repeat
put JeanList

regards
David

>
> thanks.
> -- Greetings.
>
> Yves COPPE
>
> Email : [EMAIL PROTECTED]
> _______________________________________________
> use-revolution mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to