Strange results in deletion of lines
Jim Ault
jimaultwins at yahoo.com
Tue May 11 19:41:38 EDT 2010
>
> On May 11, 2010, at 3:27 PM, Douglas wrote:
> Hang on, you just happened to throw in that you ALSO want to do
> processing with the lines that you just asked to be deleted!
> It seems silly to go through the deletion when you are going to have
> to go through the whole search over again.
>
> Surely it would have been better to sort the data into separate
> variables or even arrays rather than deleting in the first place?
> This would keep the data separate for secondary processing and if
> referenced in array could also hold references to the original
> placing in the source file/variable if required.
>
>
> On 11/05/2010 04:51, David C. wrote:
>> Then I get to build a second version that keeps the deleted "F" items
>> in place while removing everything else.
I would use the filter command for speed and programming clarity.
get tMyData
filter IT with "F*"
-- now IT contains all lines starting with "F"
filter tMyData without "F*"
-- now tMyData contains all other lines
repeat for each line L in IT
process L
put L & CR after tOutputFLines
end repeat
The reason I would be careful of using arrays is that duplicate lines
would be lost since the keys would be identical.
Jim Ault
Las Vegas
More information about the use-livecode
mailing list