473,786 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

newline character

in VB.NET you can do

sb = New StringBuilder(" Hello")
sb.Append(vbCrL f)

What is the C# analogy to vbCrLf ?
Nov 17 '05 #1
8 13045
System.Environm ent.NewLine

--

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

sb = New StringBuilder(" Hello")
sb.Append(vbCrL f)

What is the C# analogy to vbCrLf ?

Nov 17 '05 #2
System.Environm ent.NewLine

--

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

sb = New StringBuilder(" Hello")
sb.Append(vbCrL f)

What is the C# analogy to vbCrLf ?

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

I would simply use "\r\n";

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

I would simply use "\r\n";

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


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.New Line 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.co m>
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.Environm ent.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.New Line 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.co m>
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.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
J.S. <js*@nospam.com > wrote:
System.Environm ent.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.New Line 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.co m>
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.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
J.S. <js*@nospam.com > wrote:
System.Environm ent.NewLine


No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.New Line 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.co m>
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
10314
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 sure that there was a way around it but it escapes me if there is one. Thanks Charles Erwin
29
3480
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
3049
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 characters width and I am comparing the first character of the line with the $ sign which seperates different blocks of information $ Nodes of the Entire Model
4
4494
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 - I assume that it is a runtime property, and not compile time? But won't it always be the same anyway - does dotnet run on anything other than windows platforms? So isn't newline always the same?
5
7001
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 mail. Thanks...
9
1865
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 text another line of text yet another</bar> I've tried <xsl:copy-of select="foo/text()" />, I've tried
6
18411
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
38623
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 into the buffer ?
11
6253
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 string multiline = "The first line." + Environment.NewLine +
11
24925
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 HTML <br>, which I would have expected - what it does is generate a newline in the html generated text, but since the browser ignores blank lines, this feature appears useless for most applications.
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.