Boost logo

Boost Users :

From: Pavol Droba (droba_at_[hidden])
Date: 2008-04-15 10:49:01


Hi,

Dmitry Teslenko wrote:
> Hello!
> For example I want to split string with single char '\t' delimeter.
> According to docs this can be done this way:
> std::vector<std::string> options;
> std::string sep;
> sep += '\t';
> boost::split(options, line, boost::is_any_of(sep));
>
> But if I want to use double tab as a delimiter? Is there an
> alternative to boost::is_any_of like "boost::just_what_i_say"

You can use boost::split_iterator with first_finder. Or if you prefer
split-like interface, have a look at iter_split.

Here is an example

std::vector<std::string> options;
std::string sep;
      sep += '\t';
boost::iter_split(options, line, boost::first_finder("\t\t"));

Regards,
Pavol.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net