Fastest way to delete non-contiguous lines in list field

Jan Schenkel janschenkel at yahoo.com
Tue Jul 1 01:05:00 EDT 2003


--- "valetia at mac.com" <valetia at mac.com> wrote:
> Hi all,
> 
> What's the fastest way to delete non-contiguous
> lines in a list field? These
> lines would be listed in the "hilitedLines".
> 
> TIA,
> Valetia
> 
> 

Hi Valetia,

Your problem would be that you have to either keep
track of the lines you have already deleted, or go
from the bottom to the top to avoid this but then you
can't use a 'repeat for each' construct, unless...
Try the following :

put the text of fld "Foobar" into tText
put the hilitedLines of fld "Foobar" into tLineNumbers
sort items of tLineNumbers numeric descending
repeat for each item tLineNumber in tLineNumbers
  delete line tLineNumber of tText
end repeat
set the text of field "Foobar" to tText

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the use-livecode mailing list