«« Next » « Previous
«« Next » « Previous

Link Details

The more, the merrier! Login and vote now.
Link 65879 thumbnail

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.
  • 4
  • 0
  • 333
  • 26

Comments

Add your comment
User 251813 avatar

Ryan Ginstrom replied ago:

0 votes Vote down Vote up Reply

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("|")

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (4)



Voters Against This Link (0)