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. Web Development
  3. ASP.NET
  4. Double quote variables

Double quote variables

Scheduled Pinned Locked Moved ASP.NET
7 Posts 5 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.
  • V Offline
    V Offline
    VK Cadec
    wrote on last edited by
    #1

    Hi, Instead of a R,D want to change the format to "R", "D". I have tried embedding some formatting like string = """ & "R" & """ & "," & _ """ & "D" & """ Thanks for your time.

    C D 2 Replies Last reply
    0
    • V VK Cadec

      Hi, Instead of a R,D want to change the format to "R", "D". I have tried embedding some formatting like string = """ & "R" & """ & "," & _ """ & "D" & """ Thanks for your time.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You don't need to create the quotes seperately, you can build it all as one string. This is language specific question that has nothing to do with ASP.NET, it looks like this is VB, which means I don't know exactly how to do it, in C# you use \"

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • V VK Cadec

        Hi, Instead of a R,D want to change the format to "R", "D". I have tried embedding some formatting like string = """ & "R" & """ & "," & _ """ & "D" & """ Thanks for your time.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        To add to what Chrstian said:

        string = """R"",""D"""
        

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        D 1 Reply Last reply
        0
        • D Dave Kreskowiak

          To add to what Chrstian said:

          string = """R"",""D"""
          

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          D Offline
          D Offline
          doWhileSomething
          wrote on last edited by
          #4

          Another option worth a look at, would be to use string.format. It might not be especially usefull for two charectors, but works well with medium to larger strings. VB Dim s As String = String.Format("{0}{1}{0}, {0}{2}{0}", """", "R", "D") C# string s = string.Format("{0}{1}{0}, {0}{2}{0}", "\"", "R", "D"); This first argument is the format of the string (between first set of quotes), then just supply the parameters that you made place holders for (in the example 3). *Edit (Added C# example - sorry I work with VB more than C#) -- modified at 21:44 Monday 23rd July, 2007

          My Personal Site

          P 1 Reply Last reply
          0
          • D doWhileSomething

            Another option worth a look at, would be to use string.format. It might not be especially usefull for two charectors, but works well with medium to larger strings. VB Dim s As String = String.Format("{0}{1}{0}, {0}{2}{0}", """", "R", "D") C# string s = string.Format("{0}{1}{0}, {0}{2}{0}", "\"", "R", "D"); This first argument is the format of the string (between first set of quotes), then just supply the parameters that you made place holders for (in the example 3). *Edit (Added C# example - sorry I work with VB more than C#) -- modified at 21:44 Monday 23rd July, 2007

            My Personal Site

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            I was going to do a String.Format example, I guess you beat me to it :)

            "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

            V 1 Reply Last reply
            0
            • P Paul Conrad

              I was going to do a String.Format example, I guess you beat me to it :)

              "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

              V Offline
              V Offline
              VK Cadec
              wrote on last edited by
              #6

              Used Chr(34) which seemed to work as well. Thanks for all the help.

              P 1 Reply Last reply
              0
              • V VK Cadec

                Used Chr(34) which seemed to work as well. Thanks for all the help.

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #7

                That'll work just fine, as well.

                "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                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