笔记:boost中split函数的用法

来源:互联网 发布:中国省市区数据库 编辑:程序博客网 时间:2024/05/20 01:08


来自网络:

#include <iostream>
#include <string>
#include <vector>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>


using namespace std;
using namespace boost;


int main()
{
        string s("sss///,ddd,ggg");
        vector<string> vstr;


        split(vstr, s, is_any_of(",/"), token_compress_on);


        for(vector<string>::iterator it = vstr.begin(); it != vstr.end(); ++it)
{
cout << *it << “ ”;
}

cout << endl;


        return 0;
}


输出:

sss ddd ggg

0 0