我不确定如何使用boost::is_any_of
使用一组字符拆分字符串,其中任何一个字符都应拆分字符串。使用boost的多个拆分令牌:: is_any_of
我想要做这样的事情,因为我明白is_any_of函数需要Set参数。
std::string s_line = line = "Please, split|this string";
std::set<std::string> delims;
delims.insert("\t");
delims.insert(",");
delims.insert("|");
std::vector<std::string> line_parts;
boost::split (line_parts, s_line, boost::is_any_of(delims));
但是,这会产生一个boost/STD错误列表。 我应该坚持is_any_of
还是有更好的方法来做到这一点,例如。使用正则表达式分割?
“is_any_of”没有采用迭代器范围是一件很遗憾的事情。 – Inverse 2011-02-25 17:45:52