473,385 Members | 1,569 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,385 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 13025
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...
1
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.