//參數說明:
//source: 需要分割的源字符串;
//dest: 存儲分割後的各個字符串變量的目標變量;
//division:分割字符
void CHelloWordlDlg::DecodeCString(CString source, CStringArray& dest, char division)
{
dest.RemoveAll();
int nCount=0;
for(int i=0;i< source.GetLength();i++)
{
if(source.GetAt(i)== division)
{
nCount=i;
dest.Add(source.Left(i)); //去掉右邊
int nIndex=dest.GetSize()-1;
for(int j=0;j <nIndex;j++)
{
dest[nIndex] = dest[nIndex].Right(dest[nIndex].GetLength()-dest[j].GetLength()-1); //去掉左邊
TRACE0(dest[nIndex]+"\n");
}
}
}
//處理最後一個分隔符division右邊的剩餘部分。
dest.Add(source);
int nIndex2=dest.GetSize()-1;
for(int j=0;j <nIndex2;j++)
{
dest[nIndex2] = dest[nIndex2].Right(dest[nIndex2].GetLength()-dest[j].GetLength()-1); //去掉左邊
TRACE0(dest[nIndex2]+"\n");
}
}