Boost logo

Boost Users :

From: David Brownell (david_brownell_at_[hidden])
Date: 2005-01-28 12:50:13


Thanks for your quick response, Pavol, this did the trick and cleared up my
misunderstanding. Might I suggest an overloaded version of split that takes
a string/character string as a delimiter. Althought the implementation
details are different, I still think it fits well into the intent of the
split algorithm and may clear up issue for others have the same problem as I
did.

Thanks again for your help!
David Brownell

"Pavol Droba" <droba_at_[hidden]> wrote in message
news:<20050128071103.GC31065_at_[hidden]>...
> Hi,
>
>
> It is possible to achieve what you want quite easily. However, split
algorithm
> is not the right tool for this.
> Split is a high level wrapper over the split_iterator and it is quite
specialized.
>
> So this is the code, that should work for you:
>
> #include <boost/algorithm/string/find_iterator.hpp>
> #include <boost/algorithm/string/finder.hpp>
>
> static char const STRING[] = "this\r\nis\r\n\r\na test!";
>
> typedef boost::split_iterator<const char*> char_split_iterator;
>
> for(char_split_iterator It=char_split_iterator(STRING,
boost::first_finder("\r\n");
> It!=char_split_iterator();
> ++It)
> {
> cout << *It << endl;
> }
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net