At 11:45 am +0200 25/7/02, Yves Copp� wrote:
>Hi,
>
>
>I'd like someone help me writing a fsat function :
>I have a liste of lines (big list !)
>The number of lines of the list is variable
>I'd like that the list appears in the reverse orde so that
>
>line 1 -> last line
>...
>...
>last line -> line 1
>
>something like :
>
>function reverseLines tList
>
>
>    return tresult
>end reverseLines
>--

Here are two. The second is faster on 1000-line list of short lines 
(14-18 chrs per line), 20ms versus 28ms.  It may vary on 
differently-sized  lists. But I suspect "put .. after" is faster than 
"put ... before".

function reverseLines tList
   repeat for each line tLine in tList
     put tLine & cr before tResult
   end repeat
   delete last char of tResult
   return tResult
end reverseLines

function reverseLines2 tList
   split tList by cr
   put the number of lines of keys(tList) into tNumKeys
   repeat with i = tNumKeys down to 1
     put tList[i] & cr after tResult
   end repeat
   delete last char of tResult
   return tResult
end reverseLines2

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

Reply via email to