Sign up to create your own snipts, or login.

Public snipts » Fotinakis's snipts » tokenize The latest tokenize snipts from Fotinakis.

showing 1-1 of 1 snipts for tokenize
  • Tokenize a string in C++
    #include <string>
    #include <sstream>
    #include <algorithm>
    #include <iterator>
    #include <vector>
    using namespace std;
    
    int main() {
    	string sentence = "All of this has happened before...";
    	
    	vector<string> tokens;
    	istringstream iss(sentence);
    	copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter<vector<string> >(tokens));
    }
    

    copy | embed

    0 comments - tagged in  posted by Fotinakis on Sep 13, 2009 at 7:34 p.m. EDT
Sign up to create your own snipts, or login.