Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbCrLf in C# 1

Status
Not open for further replies.

lfc77

Programmer
Aug 12, 2003
218
GB
What is the equiavalent of vbCrLf (carriage return line feed) in C#? I need to remove these from my multiline text box.

strFaultDetail = Replace(Request.QueryString("faultdetail"), vbCrLf, " ")

Cheers,

lfc77
 
Hi,

I had some trouble using this with the String.Append function. Somebody told me about the Environment.Newline constant in the System.Environment collection.

Maybe useful? Maybe not......

Dom
 
The newline constanst is a string constant of, guess what...
Code:
"\r\n"
...but it's easier to use sometimes than trying to append the string "\r\n" itself.

Rhys
Buffy: Spike, what are you doing here, five words or less!
Spike: Out for a walk... bitch!
 
For general use, Environment.Newline will probably return the correct value when you're running .NET on a Unix machine (via Mono or Rotor), so I would opt for that rather than hard-coded constants. If you need the file, stream, etc. to work in both worlds, then you need to decide which style to use.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top