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. How To Add Carriage Return Char To a String, Anyone?

How To Add Carriage Return Char To a String, Anyone?

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 4 Posters 2 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.
  • K Offline
    K Offline
    Khang Nguyen
    wrote on last edited by
    #1

    Dear gurus, I am adding "\n" to a string, not working. Do I use "Convert.ToChar(some int here?)" ? Thanks so much Khang Nguyen :-D

    A W J K 4 Replies Last reply
    0
    • K Khang Nguyen

      Dear gurus, I am adding "\n" to a string, not working. Do I use "Convert.ToChar(some int here?)" ? Thanks so much Khang Nguyen :-D

      A Offline
      A Offline
      Arun Bhalla
      wrote on last edited by
      #2

      Try "\r" for a carriage return, "\n" for a newline.

      1 Reply Last reply
      0
      • K Khang Nguyen

        Dear gurus, I am adding "\n" to a string, not working. Do I use "Convert.ToChar(some int here?)" ? Thanks so much Khang Nguyen :-D

        W Offline
        W Offline
        Wesner Moise
        wrote on last edited by
        #3

        You may have to "\r\n" because the standard DOS newline sequence is two characters '\r' followed by '\n' as opposed to the one character version used by UNIX and MACINTOSH.

        1 Reply Last reply
        0
        • K Khang Nguyen

          Dear gurus, I am adding "\n" to a string, not working. Do I use "Convert.ToChar(some int here?)" ? Thanks so much Khang Nguyen :-D

          J Offline
          J Offline
          Jose Fco Bonnin
          wrote on last edited by
          #4

          Try with Environment.NewLine

          1 Reply Last reply
          0
          • K Khang Nguyen

            Dear gurus, I am adding "\n" to a string, not working. Do I use "Convert.ToChar(some int here?)" ? Thanks so much Khang Nguyen :-D

            K Offline
            K Offline
            Khang Nguyen
            wrote on last edited by
            #5

            Hey, you gurus are fantastic. Both "\r\n" and Environment.NewLine work. Appreciate it so much Khang Nguyen :laugh:

            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