Page 1 of 1

trim /r/n

Posted: Sun Jan 27, 2008 4:33 pm
by Weasel73
I'm trying to trim returns. I'm not having much luck accomplishing this simple task. Must be one of those days.

Anyway, I know there is no trim function in transcript and I've read the documents and came up with the following code.

Code: Select all

    put the text of me into RText
    answer RText
    repeat for each line theLine in RText
        return char 1 to -2 of theLine afer NewRText
    end repeat
    answer "New Text" & NewRText
It compiles, but does not work. I can't even tell if it is doing anything, as it doesn't give me the final answer.

Any help is appreciated.

Posted: Sun Jan 27, 2008 6:21 pm
by Mark
Hi,


replace cr with space in myText

or

replace numToChar(13) with empty in myText

et cetera


Mark

Posted: Sun Jan 27, 2008 7:23 pm
by Weasel73
Mark, That worked. Thanks.