// 返回字符串分割后的数组 void DecodeCString(CString sSource, CStringArray &arrDest, char cDivision); // ------------------------------------------------------------------ // 返回字符串分割后的数组 // add by jzh 2009-07-06 // ------------------------------------------------------------------ void CommFunc::DecodeCString(CString sSource, CStringArray &arrDest, char cDivision) { arrDest.RemoveAll(); int nCount = 0; for(int i=0; i< sSource.GetLength(); i++) { if(sSource.GetAt(i) == cDivision) { nCount=i; arrDest.Add(sSource.Left(i)); //去掉右边 int nIndex = arrDest.GetSize()-1; for(int j=0;j <nIndex;j++) { arrDest[nIndex] = arrDest[nIndex].Right(arrDest[nIndex].GetLength() - arrDest[j].GetLength()-1); //去掉左边 //TRACE0(arrDest[nIndex]+"\n"); //输出调试信息 } } } //处理最后一个分隔符cDivision右边的剩余部分 arrDest.Add(sSource); int nIndex2 = arrDest.GetSize()-1; for(int j=0;j <nIndex2; j++) { arrDest[nIndex2] = arrDest[nIndex2].Right(arrDest[nIndex2].GetLength() - arrDest[j].GetLength()-1); //去掉左边 //TRACE0(arrDest[nIndex2]+"\n"); //输出调试信息 } }