void CXXX::SplitCString(CString strSource, CString ch, vector<CString> &vecDes) { CString strTemp = strSource; int ilen = strTemp.GetLength(); int idx = strTemp.Find(ch); while (idx > -1)//注意这里是-1 { vecDes.push_back(strTemp.Left(idx)); strTemp = strTemp.Right(ilen - idx - 1); idx = strTemp.Find(ch); ilen = strTemp.GetLength(); } if (ilen > 0) { vecDes.push_back(strTemp); } }