Strange results in deletion of lines

Terry Judd tsj at unimelb.edu.au
Mon May 10 22:48:47 EDT 2010


David - unless you have huge numbers of lines it's probably easiest to just
use the filter command.

filter tHold without "F*"

The reason your repeat method isn't working is that tCount is only valid
until the first deletion takes place

So either use...

repeat with j = tCount down to 1
  if char 1 of line j of tHold is "F" then delete line j of tHold
end repeat

Or use the repeat for each form and build a new list as you go...

put empty into tList
repeat for each line tID in tHold
  if char 1 of tID is "F" then put tID cr after tList
end repeat
delete last char of tList -- removes the trailing CR

HTH,

Terry...


On 11/05/10 12:34 PM, "David C." <davidocoker at gmail.com> wrote:

> Hey folks,
> I've run into something weird again (at least it seems weird to me)
> and need some help. I have a variable named tHold that contains the
> following (targeted) lines of text among many others:
> 
> FB460V-CS05
> FD620DCS26
> FD751VAS00
> FE290DDS00
> FE290DES17
> FE400DES03
> FH381VAS29R
> FH430VBT25M
> 
> What I'm trying to do is to delete any line that begins with "F" and
> the working code looks something like this:
> 
> put the number of lines in tHold into tCount
> 
>   repeat with j = 1 to tCount
>       if character 1 of line j of tHold = "F" then delete line j of tHold
>   end repeat
> 
> For some reason that I cannot detect, it removes only 4 of the eight
> potential lines that are targeted although they all clearly begin with
> an "F". I've checked and double-checked my sample data to make sure
> there are not any spaces preceding the "F" character for each.
> 
> Ideas? Better method?
> 
> Best regards,
> David C.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list