Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. a single carriage return means new line? [modified]

a single carriage return means new line? [modified]

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LiYS
    wrote on last edited by
    #1

    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

    S J 2 Replies Last reply
    0
    • L LiYS

      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

      S Offline
      S Offline
      Saksida Bojan
      wrote on last edited by
      #2

      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[^]

      1 Reply Last reply
      0
      • L LiYS

        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

        J Offline
        J Offline
        Jimmanuel
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups