The more, the merrier! Login and vote now.
By mswatcher
via codeproject.com
Submitted: Feb 11 2008 / 22:39
This article will present the tokenizing and splitting functionality of a simple C++ library called the String Toolkit. Tokenization in the context of string processing, is the method by which a sequence of elements are broken up or fragmented in sub-sequences. The indicies in the original sequence that determine such breaks in the sequence are known as delimiters.
Comments
Ryan Ginstrom replied ago:
It's a good article, but it shows how clumsy C++ is for text processing.
std::string s = "abc|123|xyz|789";
std::list< std::pair< std::string::const_iterator,std::string::const_iterator > > token_list;
strtk::single_delimiter_predicate<std::string::value_type> predicate('|');
strtk::split(s,predicate,std::back_inserter(token_list));
cf Python: tokens = s.split("|")
Voters For This Link (4)
Voters Against This Link (0)