`
dotcpp
  • 浏览: 59475 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

按字符串分割字符串

 
阅读更多
void Split(const CString& content, const CString& pattern, std::vector<CString>& strlist)
{
	int iPos = content.Find(pattern), iStart = 0;
	int i = 0;
	while (iPos != -1)
	{
		strlist.push_back(content.Mid(iStart, iPos - iStart));
		iStart = iPos + pattern.GetLength();
		iPos = content.Find(pattern, iStart);
		i++;
	}
	if (iStart <= content.GetLength())
		strlist.push_back(content.Mid(iStart));
}
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics