/*
* Author : maben
* Date : 2014-08-06
* @szDelimiter : 分割符
* @strContent : 待查找的字符串
* @arrDest : 保存分割之后的数组
*/
void Explode(TCHAR szDelimiter, CString strContent, CStringArray& arrDest)
{
arrDest.RemoveAll();
int nOffset = 0;
while (true)
{
nOffset = strContent.ReverseFind(szDelimiter);
if (nOffset == -1)
{
if (!strContent.IsEmpty())
arrDest.Add(strContent);
break;
}
CString strItem = strContent.Mid(nOffset+1);
if (!strItem.IsEmpty())
{
arrDest.Add(strItem);
}
strContent = strContent.Left(nOffset);
}
}
|