
Hello! For example I want to split string with single char '\t' delimeter. According to docs this can be done this way: std::vectorstd::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"

Hi Dmitry, Check out regex_token_iterator in the Boost Regex documentation. It will let you use any kind of delimiter you want, including regular expressions. Also, split() can split the string on multiple delimiters, so it would work on one or more tab characters. However, if you want it to split only on double tabs, and not one or three or more, then it wouldn't be suitable. For that, regex_token_iterator would be best. Regards, Markus. 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::vectorstd::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" _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

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::vectorstd::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::vectorstd::string options; std::string sep; sep += '\t'; boost::iter_split(options, line, boost::first_finder("\t\t")); Regards, Pavol.
participants (4)
-
Dmitry Teslenko
-
Markus Svilans
-
Pavol Droba
-
Surya Kiran Gullapalli