gettingstarted
[Top] [All Lists]

Re: Create Constant for chr(13) and the like

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Create Constant for chr(13) and the like
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Wed, 30 Jun 2004 11:39:08 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
List-help: <mailto:gettingstarted-request@lists.realsoftware.com?subject=help>
List-id: Getting Started <gettingstarted.lists.realsoftware.com>
List-post: <mailto:gettingstarted@lists.realsoftware.com>
References: <000001c45ebe$96e9fa10$6501a8c0 at travergateway>
At 12:23 PM -0400 6/30/04, Barry Traver wrote:

The point is that when you work with a HTML file from a UNIX server and
you're breaking the file up into individual lines from an "editfield" or
"textbox," the delimiter isn't necessarily a carriage return plus a line
feed, so using something like cr, lf, and crlf in my code makes it
easier for me to keep track of what's going on.

True -- but just to take this opportunity to explore RB: you could use EndOfLine.Windows, EndOfLine.Unix, and EndOfLine.Macintosh instead. Also, an EditField will accept any standard line ending when you dump text into it, and do the right thing. So will a TextInputStream: when you use ReadLine, it'll read a line regardless of what line ending it has.

Finally, when you're writing a file, you can just set TextOutputStream.Delimiter to whatever line ending you want (e.g. EndOfLine.Unix, or Chr(13), or whatever), and it'll write that after each call to WriteLine.

So I think perhaps line endings are easier to deal with in RB, and don't require any mucking about with ASCII codes most of the time.

Best,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>