how to extract words from a string in C++ [duplicate]
Possible Duplicate:
How do I tokenize a string in C++?
I have a string "this is a string", and I want to iterate over all the words in this string. Is there a way in which i can easily do this without having to parse it.
Thanks
void do_something(const std::string& word);
std::for_each( std::istream_iterator<std::string>(is)
, std::istream_iterator<std::string>()
, do_something );
精彩评论