473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

newline character

in VB.NET you can do

sb = New StringBuilder("Hello")
sb.Append(vbCrLf)

What is the C# analogy to vbCrLf ?
Nov 17 '05 #1
8 13024
System.Environment.NewLine

--

"John Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
in VB.NET you can do

sb = New StringBuilder("Hello")
sb.Append(vbCrLf)

What is the C# analogy to vbCrLf ?

Nov 17 '05 #2
System.Environment.NewLine

--

"John Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
in VB.NET you can do

sb = New StringBuilder("Hello")
sb.Append(vbCrLf)

What is the C# analogy to vbCrLf ?

Nov 17 '05 #3
J.S. wrote:
System.Environment.NewLine

I would simply use "\r\n";

www.freelancedotnetdeveloper.com
Nov 17 '05 #4
J.S. wrote:
System.Environment.NewLine

I would simply use "\r\n";

www.freelancedotnetdeveloper.com
Nov 17 '05 #5
J.S. <js*@nospam.com> wrote:
System.Environment.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.NewLine is whatever the normal new line is *for the
platform you're running on* - on platforms other than Windows, it may
well not be "\r\n".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #6
J.S. <js*@nospam.com> wrote:
System.Environment.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.NewLine is whatever the normal new line is *for the
platform you're running on* - on platforms other than Windows, it may
well not be "\r\n".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #7
Just a note too that \r is carriage return and \n is line feed, so if all
you want is line feed then \n is enough. When printing to the old style
printers you can simply go down a line with the \n.

Also, note that Apple performs both a carriage return and a line feed when
you do a \n by itself, where as Microsoft requires both.

JIM

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
J.S. <js*@nospam.com> wrote:
System.Environment.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.NewLine is whatever the normal new line is *for the
platform you're running on* - on platforms other than Windows, it may
well not be "\r\n".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #8
Just a note too that \r is carriage return and \n is line feed, so if all
you want is line feed then \n is enough. When printing to the old style
printers you can simply go down a line with the \n.

Also, note that Apple performs both a carriage return and a line feed when
you do a \n by itself, where as Microsoft requires both.

JIM

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
J.S. <js*@nospam.com> wrote:
System.Environment.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.NewLine is whatever the normal new line is *for the
platform you're running on* - on platforms other than Windows, it may
well not be "\r\n".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Charles Erwin | last post by:
Is there any way, upon scanning in a file line by line to avoid missing the last line if there is not a newline character (aka you have to hit return on the last line of input in your file). I was...
29
by: runningdog | last post by:
Hi, I would like to be able to embed a newline in a text string. Is there any convienent notation to do this TIA Steve
1
by: utab | last post by:
Hi there I am trying to read from a file, I am trying to read certain fields,there are 6 fields in this file like --------/--------/--------/--------/--------/--------/ All fields are 8...
4
by: Peter Kirk | last post by:
Hi I would like to ask a little bit about the value Environment.Newline: what is it and what is the point of it? Ok, I can see in the docs that it represents "newline" for the current platform -...
5
by: Adam Right | last post by:
Hi, Is there a way to construct the mail body including newline characters by using .net framework mailing functions when sending an email? I cannot insert newline character into the body of the...
9
by: will | last post by:
I have an XML input that includes things like: <foo>line of text another line of text yet another</foo> And I want the entities PRESERVED (not translated) on the result, so: <bar>line of...
6
by: Daniel Mark | last post by:
Hello all: I have the following snippet: In : fileName = 'Perfect Setup.txt\n' In : fileName = fileName # remove the '\n' character In : fileName Out: 'Perfect Setup.txt'
16
by: junky_fellow | last post by:
Is there any efficcient way of removing the newline character from the buffer read by fgets() ? Is there any library function that is similar to fgets() but also tells how many bytes it read...
11
by: rossum | last post by:
I want to declare a const multi-line string inside a method, and I am having some problems using Environment.NewLine. I started out with: class foo { public void PrintStuff() { const...
11
by: Michael | last post by:
I'm new to PHP. I see that PHP supports the C printf function, and I've seen examples like printf("Hello world!\n"); however the newline character \n doesn't work - i.e., it does not generate an...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.