Thread: Remove " character

  1. #1
    Registered User
    Join Date
    Oct 2005

    Remove " character

    How would I remove the " character from a string. The only way in which I know how to remove a character is by putting it within "s. like
    string stripPBreaks(string s) {
      int br;
      while((br = s.find("<P>")) != string::npos)
        s.erase(br, strlen("<P>"));
      while((br = s.find("</P>")) != string::npos)
        s.erase(br, strlen("</P>"));
      return s;

  2. #2
    Registered User
    Join Date
    Oct 2005
    Figured it out. Need to put \ before it. Tried putting in ' ' but that gave me an error.

  3. #3
    Cat Lover
    Join Date
    May 2005
    Sydney, Australia
    \ is known as an escape character. So a \ followed by various characters lets you insert things into strings you normally can't e.g. \n is a new line, \" is a quotation mark, etc. If you google you should be able to find a list of them fairly easily.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Remove character from string
    By nooksooncau in forum C Programming
    Replies: 11
    Last Post: 06-05-2006, 09:37 AM
  3. about wide character and multiple byte character
    By George2 in forum C Programming
    Replies: 3
    Last Post: 05-22-2006, 08:11 PM
  4. Character handling help
    By vandalay in forum C Programming
    Replies: 18
    Last Post: 03-29-2004, 05:32 PM
  5. Moving a character to stdin?
    By DeepBlackMagic in forum C Programming
    Replies: 2
    Last Post: 09-27-2003, 06:37 PM