`
nuaa_liu
  • 浏览: 25372 次
  • 性别: Icon_minigender_1
  • 来自: 南京
最近访客 更多访客>>
社区版块
存档分类
最新评论

boost::split

 
阅读更多
#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;
}


 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics