Repeat until (0r "while") not working
Chipp Walters
chipp at chipp.com
Tue Aug 9 23:22:50 EDT 2005
Katir,
If you wanted to do it in a repeat loop:
repeat with x = the number of lines in tFinalTranscript down to 1
if line x of tFinalTranscript is "" then delete line x of
tFinalTranscript
end repeat
Sivakatirswami wrote:
> I'm missing something very simple here,
>
> Goal: delete empty lines beginning and end of text chunk
>
> ---------------
>
> put fld "transcript" into tFinalTranscript
>
> # clean up extra lines at beginning and end
>
> repeat while ((line 1 of tFinalTranscript) is empty)
> delete line 1 of tFinalTranscript
> end repeat
>
> repeat until ((the last line of tFinalTranscript) is not empty)
> delete the last line of tFinalTranscript
> end repeat
>
> put tFinalTranscript
> exit to top
> ------------
> It still has all the empty lines top and bottom. If I globalize the
> temp variable for a bit, then test the field or the variable from the
> msg box:
>
> "line 1 of tFinalTranscript is empty" returns true
> "the last line of fld "transcript" is empty" returns true
>
> But these handlers are not deleting the blank lines as expected.. what
> am I doing wrong? I don't think I need all those parentheses... only
> added to try to get it to work... still doesn't
>
> TIA
> Sivakatirswami
More information about the use-livecode
mailing list