Strange results in deletion of lines
tsj at unimelb.edu.au
Mon May 10 21:48:47 CDT 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
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
delete last char of tList -- removes the trailing CR
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:
> 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
More information about the use-livecode