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. Problem with String

Problem with String

Scheduled Pinned Locked Moved C#
questiondata-structureshelp
6 Posts 4 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.
  • R Offline
    R Offline
    Rick van Woudenberg
    wrote on last edited by
    #1

    Hello all, I have a little problem regarding a double quote. I wrote this filter, to weed out all invalid characters in an Excel sheet. It works fine, however my invalid character list is defined in a string array. One of the invalid characters is "

                string invalidChar = "' \` # ";
                string\[\] invChar = invalidChar.Split(' ');
    

    How do I get " into the string as well ? kind regards,

    L C 2 Replies Last reply
    0
    • R Rick van Woudenberg

      Hello all, I have a little problem regarding a double quote. I wrote this filter, to weed out all invalid characters in an Excel sheet. It works fine, however my invalid character list is defined in a string array. One of the invalid characters is "

                  string invalidChar = "' \` # ";
                  string\[\] invChar = invalidChar.Split(' ');
      

      How do I get " into the string as well ? kind regards,

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      "\""

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      1 Reply Last reply
      0
      • R Rick van Woudenberg

        Hello all, I have a little problem regarding a double quote. I wrote this filter, to weed out all invalid characters in an Excel sheet. It works fine, however my invalid character list is defined in a string array. One of the invalid characters is "

                    string invalidChar = "' \` # ";
                    string\[\] invChar = invalidChar.Split(' ');
        

        How do I get " into the string as well ? kind regards,

        C Offline
        C Offline
        c2423
        wrote on last edited by
        #3

        See above for the solution proposed by leppie, which will work, however I prefer:

        string invalidChar = @"' ` "" # ";
        string[] invChar = invalidChar.Split(' ');

        I find it more readable. Chris

        R E 2 Replies Last reply
        0
        • C c2423

          See above for the solution proposed by leppie, which will work, however I prefer:

          string invalidChar = @"' ` "" # ";
          string[] invChar = invalidChar.Split(' ');

          I find it more readable. Chris

          R Offline
          R Offline
          Rick van Woudenberg
          wrote on last edited by
          #4

          Both option works , I tested it :) Thank you both

          1 Reply Last reply
          0
          • C c2423

            See above for the solution proposed by leppie, which will work, however I prefer:

            string invalidChar = @"' ` "" # ";
            string[] invChar = invalidChar.Split(' ');

            I find it more readable. Chris

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #5

            If we are going for readable:

            char[] invalidCharacters = { '"', ',', '$', '\'' };

            Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
            Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
            Most of this sig is for Google, not ego.

            C 1 Reply Last reply
            0
            • E Ennis Ray Lynch Jr

              If we are going for readable:

              char[] invalidCharacters = { '"', ',', '$', '\'' };

              Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
              Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
              Most of this sig is for Google, not ego.

              C Offline
              C Offline
              c2423
              wrote on last edited by
              #6

              I hadn't thought of that - much neater. For things like file paths it is useful to know about using @ as well. Chris

              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