Boost logo

Boost Users :

From: Thore B.Karlsen (sid_at_[hidden])
Date: 2006-07-24 16:03:00


On Mon, 24 Jul 2006 14:53:51 -0500, Seth Nielson <sethjn_at_[hidden]>
wrote:

>No, that won't suit my needs. Did you read my message? I said I need
>MARK to be a substring, not a single character.

Use a split iterator:

string str = "1ab2ab3";
vector<string> results;

typedef boost::split_iterator<std::string::iterator>
   string_split_iterator;

for (string_split_iterator it = make_split_iterator(str,
   first_finder("ab")); it != string_split_iterator();
   ++it)
{
   results.push_back(*it);
}

As for which one is preferable, I like the string algo library much
better than I like the tokenizer library. It's very, very good.

-- 
Be seeing you.

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