#include "boost/algorithm/string.hpp"
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
using namespace boost;
int main(int argc,char* argv[])
{
/*template<typename SequenceSequenceT, typename RangeT, typename PredicateT>
SequenceSequenceT &
split(SequenceSequenceT &, RangeT &, PredicateT,
token_compress_mode_type = token_compress_off);*/
typedef vector<string> VECSTRING;
VECSTRING vecDemo;
string strDemo = "test1^&^arc2^&^asd3";
split(vecDemo,strDemo,is_any_of("^&^"),token_compress_on);
/*
string strDemo = "1^2^3";
split(vecDemo,strDemo,is_any_of("^"),token_compress_off);*/
VECSTRING::iterator iter;
for(iter = vecDemo.begin(); iter != vecDemo.end(); ++iter)
{
printf("%s\n",(*iter).c_str());
}
return 0;
}
boost::split
最新推荐文章于 2024-09-27 11:26:03 发布