String Tokenizer question

I am using boost 1.31 Tokenizer. The question I have is Can boost tokenizer change the predicates on the fly? For example: string s = "my birthday is 1976, 15/17"; boost::tokenizer<> tok(s); boost::tokenizer<>::iterator beg=tok.begin(); // here *beg will give us "my" typedef boost::tokenizer<boost::char_separator<char> > Boost_char_tokenizer; boost::char_separator<char> sep(",/"); Boost_char_tokenizer next(s, sep); Boost_char_tokenizer::iterator tok_iter = next.begin(); for(; tok_iter!=next.end(); ++tok_iter){ std::cout << *tok_iter << std::endl; } // this will give us "my birthday is 1976", "15" and "17" But what I want to get is "my", "birthday is 1976", "15" and "17". In other words, I want the tokenizer either can give us the remaining of the string or can change the delimiters dynamically. Is there a way to do this? Thanks for any help.

string s = "my birthday is 1976, 15/17";
I want to get is "my", "birthday is 1976", "15" and "17".
According to the documentation boost tokenizer 1.32 uses a TokenizerFunction to parse the string. If you provide your own function you can parse the string however you want. Hope his helps -delfin

I can not use 1.32 because I am using VC6. "Delfin Rojas" <drojas@moodlogic.com> wrote in message news:200507120205.j6C25FXk012979@patti.moodlogic.com...
string s = "my birthday is 1976, 15/17";
I want to get is "my", "birthday is 1976", "15" and "17".
According to the documentation boost tokenizer 1.32 uses a TokenizerFunction to parse the string. If you provide your own function you can parse the string however you want.
Hope his helps
-delfin
participants (2)
-
Delfin Rojas
-
J Liu