Repeat until (0r "while") not working

Dave Cragg dcragg at lacscentre.co.uk
Wed Aug 10 04:44:45 EDT 2005


On 10 Aug 2005, at 02:17, 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

This part works here, with or without the parentheses.

Thoughts:
Are the leading lines really empty? For example, you don't have a  
crlf there instead of a normal return. Or possibly you have set a  
different lineDelimiter.


>
> repeat until ((the last line of tFinalTranscript) is not empty)
>   delete the last line of  tFinalTranscript
> end repeat

This may not do what you expect if the last char is a return.  
Although it displays as though there is a blank line, Rev will  
consider the last line to be the line before the final return. You  
could add this after the second loop:

   if char -1 of tFinalTranscript is return then delete char -1 of  
tFinalTranscript



Cheers
Dave



More information about the use-livecode mailing list