您的位置:首页 > 其它

boost——string_alog字符串的操作(五)

2013-06-13 10:29 218 查看
#include  <boost/algorithm/string.hpp>
#include <boost/typeof/typeof.hpp>

using namespace boost;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string str = "Samus, Link.Zelda::Mario-Luigi+zelda" ;
deque<string> d ;
ifind_all(d, str, "zELDA") ;
assert(d.size() == 2) ;
for (BOOST_AUTO(pos, d.begin()); pos != d.end(); ++pos)
{
cout << "["<< *pos << "]" ;
}
cout << endl ;

list< iterator_range<string::iterator> > l ;
split(l, str, is_any_of(",.:+-")) ;
for(BOOST_AUTO(pos, l.begin()); pos != l.end(); ++pos)
{
cout << "["<< *pos << "]" ;
}
cout << endl ;

l.clear() ;
split(l, str, is_any_of(".:-"), token_compress_on) ;
for(BOOST_AUTO(pos, l.begin()); pos != l.end(); ++pos)
{
cout << "["<< *pos << "]" ;
}
cout << endl ;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: