使用 POCO 的方法来拆分字符串(支持中文)

#include "Poco/StringTokenizer.h"
#include 


using Poco::StringTokenizer;


int main(int argc, char** argv)
{
	std::string tokens = "white; black; 中文, blue, green; yellow";
	StringTokenizer tokenizer(tokens, ";,", StringTokenizer::TOK_TRIM);
	for (StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it)
	{
		std::cout << *it << std::endl;
	}
	return 0;
}

输出结果:

white
black
中文
blue
green
yellow


你可能感兴趣的:(C/C++,和,Python,iterator,include,string)