#include <string>
#include <sstream>
#include <iostream>
#include <iterator>
#include <vector>
std::string str("quick brown fox jumps into something that I have forgot");
std::stringstream ss(str);
std::istream_iterator<std::string> it(ss), end;
std::vector<std::string> tokens(it,end);
for(std::vector<std::string>::iterator token=tokens.begin(); token!=tokens.end(); ++token) {
std::cout << *token << std::endl;
}
Friday, December 17, 2010
A C++ way of tokenizing string
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment