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. Use of Doublequotes in a string... but it doesnt work?

Use of Doublequotes in a string... but it doesnt work?

Scheduled Pinned Locked Moved C#
question
5 Posts 2 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.
  • M Offline
    M Offline
    Matjaz xyz
    wrote on last edited by
    #1

    Hi. I tried all known solutions and now im turning to you. I cant get the " in the string. Tried with: \", @ "", """, Character converting, string converting, ... The only solution i see, is to create a label, which would be hiddent, but would contain text = ". I could borrow its text and use it in the code... but thats not it i'm afraid. string xc = "Deklica je po " +Convert.ToChar(34)+ " Vodo šla."; The result i get, by using any of know solutions is the same for anything : Result = \" String returns this.

    Regards, Matjaž

    B 1 Reply Last reply
    0
    • M Matjaz xyz

      Hi. I tried all known solutions and now im turning to you. I cant get the " in the string. Tried with: \", @ "", """, Character converting, string converting, ... The only solution i see, is to create a label, which would be hiddent, but would contain text = ". I could borrow its text and use it in the code... but thats not it i'm afraid. string xc = "Deklica je po " +Convert.ToChar(34)+ " Vodo šla."; The result i get, by using any of know solutions is the same for anything : Result = \" String returns this.

      Regards, Matjaž

      B Offline
      B Offline
      bcozican
      wrote on last edited by
      #2

      Hi Matjaz, The following line of code will insert a double quote in your string value. string xc = "Deklica je po \" Vodo šla."; Hope this helps...

      M 1 Reply Last reply
      0
      • B bcozican

        Hi Matjaz, The following line of code will insert a double quote in your string value. string xc = "Deklica je po \" Vodo šla."; Hope this helps...

        M Offline
        M Offline
        Matjaz xyz
        wrote on last edited by
        #3

        won't work. i get output: Deklica je po \" Vodo šla. don't know why backslash in text.

        Regards, Matjaž

        B 1 Reply Last reply
        0
        • M Matjaz xyz

          won't work. i get output: Deklica je po \" Vodo šla. don't know why backslash in text.

          Regards, Matjaž

          B Offline
          B Offline
          bcozican
          wrote on last edited by
          #4

          When you say output, you mean the watch window of the debugger..? The watch window of the debugger always shows the backslash before the double quote as an escape character but it will not display in your actual results. Try this by setting a label or textbox's text to the string value. You will see that there isnt a backslash in the text. Hope this helps...

          M 1 Reply Last reply
          0
          • B bcozican

            When you say output, you mean the watch window of the debugger..? The watch window of the debugger always shows the backslash before the double quote as an escape character but it will not display in your actual results. Try this by setting a label or textbox's text to the string value. You will see that there isnt a backslash in the text. Hope this helps...

            M Offline
            M Offline
            Matjaz xyz
            wrote on last edited by
            #5

            Yes, that helps a lot :) I was debugging and i was always getting the backslash and just a minute before your answer, i tried the same sentence with a label - and it worked, like you said. Thanks!

            Regards, Matjaž

            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