软件定制,程序代写 淘宝店铺:http://shop108027805.taobao.com
1 int CTools::Split(const CString &strInputSrc, const CString &strDelimite, vector<CString> &vectDest)
2 {
3 CString strSrc = strInputSrc;
4 strSrc.Trim();
5 int iPos = strSrc.Find(strDelimite);
6 if (iPos < 0) return 0;
7
8 CString strLeft = strSrc;
9 CString strOther = strSrc;
10 while (iPos >= 0){
11 strLeft = strOther.Left(iPos);
12 strLeft.Trim();
13 if (!strLeft.IsEmpty()){
14 vectDest.push_back(strLeft);
15 }
16 strOther = strOther.Mid(iPos+1, strOther.GetLength());
17 strOther.Trim();
18 iPos = strOther.Find(strDelimite);
19 }
20 if (!strOther.IsEmpty()){
21 vectDest.push_back(strOther);
22 }
23 return (int)vectDest.size();
24 }
博客来源:http://www.cnblogs.com/zhfuliang/p/3249551.html