trim /r/n

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Weasel73
Posts: 15
Joined: Wed Jan 31, 2007 2:57 am

trim /r/n

Post by Weasel73 » Sun Jan 27, 2008 4:33 pm

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.
Mac OS X 10.5
iMac,
2 GHz Core 2 Duo
3 GB RAM
RadeonHD2400 128 MB

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Jan 27, 2008 6:21 pm

Hi,


replace cr with space in myText

or

replace numToChar(13) with empty in myText

et cetera


Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Weasel73
Posts: 15
Joined: Wed Jan 31, 2007 2:57 am

Post by Weasel73 » Sun Jan 27, 2008 7:23 pm

Mark, That worked. Thanks.
Mac OS X 10.5
iMac,
2 GHz Core 2 Duo
3 GB RAM
RadeonHD2400 128 MB

Post Reply