CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Strings

  1. #1
    Join Date
    Dec 2007
    Location
    Lithuania
    Posts
    98

    Strings

    Hi

    Code:
    if ((strchr(", \n\r\t", chunckOfData[i]))  ........
    how to add to the string ", \n\r\t" also " type of simbol. I want to check also if chunckOfData[i] isn't ".

    Thankyou in advice.
    Share and always try to give back more.

  2. #2
    Join Date
    Jan 2009
    Posts
    1,689

    Re: Strings

    Obviously english isn't your first language, I'm not quite sure that I understand your question, but I will say that you should probably be using std::string instead of char*, they are much easier and flexible. Adding strings is as simple as doing string1+string2;

    Code:
    bool isChunkQuote = ChunkofData == '\"';

  3. #3
    Join Date
    Dec 2007
    Location
    Lithuania
    Posts
    98

    Red face Re: Strings

    Yes. My English isn't that good. But I will try my best

    Simple example.

    " \n\t\r"
    " " \n\t\r"

    And how to put it in this construction if ((strchr(", \n\r\t", chunckOfData[i])) ........

    Then I was toying with php some years ago I know it was posible like " \n\r/"/" or something like this...

    So I think C++ should have something similar.
    Share and always try to give back more.

  4. #4
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Strings

    Quote Originally Posted by ulumulu
    I want to check also if chunckOfData[i] isn't ".
    Basically, you are asking how to escape the double quote within a string literal? If so, then the answer is that you should escape it by prepending a backslash, e.g., ", \n\r\t\\".
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  5. #5
    Join Date
    Dec 2007
    Location
    Lithuania
    Posts
    98

    Re: Strings

    Quote Originally Posted by laserlight View Post
    Basically, you are asking how to escape the double quote within a string literal? If so, then the answer is that you should escape it by prepending a backslash, e.g., ", \n\r\t\\".
    Nice.

    did like this " \n\r\\"\" and worked like a charm.

    Thankyou laserLight.
    Share and always try to give back more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured