Tom Shelton said:
I'm not sure what you mean be standard?
I guess, by saying "platform specific" you want to say that on platform X
char Y is always used as the line separator. This is what I'd call a
"standard".
If your talking about a
formal standards body - then no, there isn't. But traditionally on
*nix a newline is a single lf (I know I said CR earlier). It's one
of those issues that tends to bite people when writing cross platform
code. *nix progams will almost always assume that a line terminates
on LF, windows/dos expects a cr/lf.
Where does "it" expect it? This sounds as if on my system everywhere CRLF is
always used, but this is not true. Consequently I can not always expect
CRLF. Consequently it doesn't make sense to prefer one of the constants over
the others because you have to decide it in each individual case. Moreover,
even if you read the /same/ file (e.g. using CRLF as the seperator) on two
different platforms, and on both systems Environment.newline is expected as
the seperator when reading the file, it doesn't help you at all. The
opposite is the case because on one system the wrong char is expected and
the file will be read wrong. Consequently, you always have to know which
seperator has been used for writing exactly this file that you are reading.
In addition, even if you know that CRLF had been used, do you know that the
programmer writing the file used Environment.Newline? Or did he use
vbNewLine? In the end it is out of interest. The only reason to prefer one
constant over the other is that you defined your own standard or your
company's standard that says that "we use environment.newline to write
files". But you could also say "we use vbNewline" - or whatever. None is
preferrable. Also, other companies might use other standards - or other
platforms. That's why I think that saying "new lines are platform specific"
is not right.