CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Location
    Bremen, Germany
    Posts
    33

    Simple string split problem

    Hallo guys,

    I have string like a html tags , which has many attributes , I want to seperate each of them

    code:
    <Configuration Name="Release|Win32" OutputDirectory="Release " IntermediateDirectory="../../../../output.tmp/Release/CacheTest/" ConfigurationType="1" CharacterSet="2">

    I used strstr and strtok functions to seperate it using the white spaces , but its useless, as some of the values in quotes have whitespaces too.

    Looking forward to your reply guys.

    mfg,
    kings
    kings4u

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Simple string split problem

    Looks like a quote followed by a space is your field delimiter.

  3. #3
    Join Date
    Oct 1999
    Location
    ks
    Posts
    523

    Re: Simple string split problem

    seems to me the solution is a bit of brute force: incrementally go throught the target string but keep a flag that indicates whether you have an unbalanced quote at any point in time. the idea is that white space will not constitute the end of a token being built if the quotes are unbalanced.

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