登录
首页 » VC++,c++ » VC++ 依据特定字符拆分字符串

VC++ 依据特定字符拆分字符串

于 2022-05-23 发布 文件大小:2.12 kB
0 212
下载积分: 2 下载次数: 1

代码说明:

int CFileFun::SplitCString(CString strIn, CStringArray& strAryRe, LPCTSTR lpstr){ASSERT(lpstr);strAryRe.RemoveAll();int len1 = strIn.GetLength();int len2 = _tcslen(lpstr);if (0 == len1 || 0 == len2){return 0;}int pos1 = 0, pos2 = 0;while ((pos2 = strIn.Find(lpstr, pos1)) != -1){strAryRe.Add(strIn.Mid(pos1, pos2 - pos1));pos1 = pos2 + len2;}//加上最一个...if (len1 > pos1 + 1){strAryRe.Add(strIn.Mid(pos1));}return strAryRe.GetSize();}

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696516资源总数
  • 106914会员总数
  • 0今日下载