EndOfLine has the advantage of being cross-platform, but much of the
time you can get away with using a variable with a constant value when
you can't use a constant.
REALbasic doesn't like it when you try to do this:
Const cr = chr(13)
Visual Basic, if I remember correctly, also dislikes that approach, BUT
- for many circumstances - why not just use something like this:
Dim cr as string
cr = chr(13)
Dim lf as string
lf = chr(10)
Dim crlf as string
crlf = cr + lf
Now, you know that cr isn't a constant, and the computer knows that cr
isn't a constant (although it may take a bit longer to process), but it
should often be able to do a passable imitation.
Caution: I'm a REALbasic novice and I think the preceding should work,
but I'm open to correction by people here who know what they're talking
about.
Visual Basic has some built-in constants (vbCR, vbLF, and vbCRLF) for
this situation, but the preceding cr, lf, and crlf (as long as they
aren't forbidden keywords) should work a similar way in REALbasic, I
would think.
Where I found such an approach useful was working with HTML files. In
Windows, it is NOT required that each line in a HTML file end with a
carriage return and a line feed. The line feed (or is it the carriage
return? - I've forgotten which at the moment) can be safely omitted (at
least on a UNIX server), and (1) the resulting file size is smaller and
(2) the file may load in more quickly into a Web browser.
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.
Since I've been benefitting from asking so many questions, I thought
maybe it was time for me to try to answer one for a change and try to
provide some help rather than just receiving it. (But if I should be
quiet in that regard until I know more, feel free to tell me that. "No
offense taken where none intended.")
Barry Traver
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|