String question

  • Thread starter Thread starter Ivan Demkovitch
  • Start date Start date
I

Ivan Demkovitch

Hi!

Completely dumb question...

I'm constructing email text in code and need to add line break.

i.e.:

s = "sdfsd" + LineBreak + "sdfsdf";

In VB I use vbNewLine

How do I make it in C#?

Thanks!
 
A better way might be to use the Environment.NewLine property.

They just map to control characters, "\n" = newline and "\r" = carriage
return.

The difference, I believe, is that the newline moves the cursor vertically
one row. The horizontal position stays the same. The carriage return moves
the cursor to the beginning of the row that it is currently one.

Although the need for these have probably gone away, they are a carry-over
from the old dos environment in which these characters would give you
control over the cursors position.
 
Ivan said:
Ok...

Now I want to know what is the difference between \n and \r\n ???

Thanks!
Nothing much except that Windows goes for "\r\n" as end of line char,
"\n" is the endof line in Unix/Linux like env, "\n\r" (I think) is the
end of line in Mac..
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top