using qutes in a string

This is a discussion on using qutes in a string within the C++ Programming forums, part of the General Programming Boards category; I have this line: Code: strUnwanted = "~`!@#$%^&*()_-+={}|[]\:;'<>?,./"; It's part of a function I'm making to strip out unwanted characters. ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    128

    using qutes in a string

    I have this line:
    Code:
    strUnwanted = "~`!@#$%^&*()_-+={}|[]\:;'<>?,./";
    It's part of a function I'm making to strip out unwanted characters. I also need " to be stripped out. How can I include it in the about string?

    On other languages, I have called it as a chr(34) so it reads the ASCII(?) value - but I had to treat it separate and couldn't have it as part of a string of unwanted characters.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Just escape it:
    "\""

    Also note that your above string is bad because it will read the \ and then escape the next character which is :. So you need to have \\ instead.

    Code:
    strUnwanted = "~`!@#$%^&*()_-+={}|[]\\:;'<>?,./\"";

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    128
    many thank you's.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  3. Something is wrong with this menu...
    By DarkViper in forum Windows Programming
    Replies: 2
    Last Post: 12-14-2002, 10:06 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 02:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21