Re: [string_algo] Split and Predicates
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@topmail.sk> wrote in message news:<20050128071103.GC31065@lenin.felcer.sk>...
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; }
participants (1)
-
David Brownell