a single carriage return means new line? [modified]
-
Hi all, I'm using c# in VS 2008, I just found out a single '\r' could be used a new line control code, why's that considering '\r' is to move the position of the cursor to the first position on the same line? Isn't '\r\n' supposed to do that? Thanks,
modified on Monday, April 27, 2009 4:10 AM
-
Hi all, I'm using c# in VS 2008, I just found out a single '\r' could be used a new line control code, why's that considering '\r' is to move the position of the cursor to the first position on the same line? Isn't '\r\n' supposed to do that? Thanks,
modified on Monday, April 27, 2009 4:10 AM
http://www.regular-expressions.info/characters.html[^] Look under: Non-Printable Characters Or better: http://www2.austin.cc.tx.us/rickster/COSC1320/handouts/escchar.htm[^]
-
Hi all, I'm using c# in VS 2008, I just found out a single '\r' could be used a new line control code, why's that considering '\r' is to move the position of the cursor to the first position on the same line? Isn't '\r\n' supposed to do that? Thanks,
modified on Monday, April 27, 2009 4:10 AM
The newline character is a system dependent mix of the carriage return (\r) and line feed (\n) characters. On Unix newline is \n, on Macs newline is \r and on Windows newline is \r\n. If you're using .Net then you should be using
Environment.NewLine
instead of a specific character sequence.