Boost::Split using whole string as delimiter
Yes there is a way (this is a way I know, maybe there is a better way) Use boost::algorithm::split_regex
to split character sequences where delimiters are regular expressions.
Example:
vector< string > result;
boost::algorithm::split_regex( result, str, regex( "^((?!abc)*abc(?!abc)*)*$" ) ) ;
copy( result.begin(), result.end(), ostream_iterator<string>( cout, "\n" ) ) ;
split_regex
as suggested by @Mythli is fine. If you don't want to deal with regex, you can use ifind_all
algo, as is shown in this example. You receive iterator_range
(begin/end) of all occurrences of you delimiter. Your tokens are between them (and at the beginning and end of string).