pepperdiyu:
void decodeCString( CString source, CStringArray& dest , CString division)
{
dest.RemoveAll();
while(true)
{
int nIndex = source.Find(division,0);
if(nIndex == -1)
{
source = source;
dest.Add(source);
}
else
{
dest.Add(source.Left(nIndex));
source = source.Right(source.GetLength() - nIndex -1);
}
if(nIndex == -1)
break;
}
}
(发表于2006-8-15 13:04:00)
dylan_ding:兄弟。。。。
MFC有一个未列入文档的函数AfxExtractSubString(CString& rString, LPCTSTR lpszFullString,int iSubString, TCHAR chSep = '\n'),很好用的!
不用这么麻烦!
(发表于2006-8-16 17:56:00)
genghz:这位兄弟精神可嘉。
void decodeCString(CString source, CStringArray& dest, char division)
{
dest.RemoveAll();
int nStart = 0,nEnd = source.Find(division);
while(nEnd > nStart)
{
dest.Add(source.Mid(nStart,nEnd - nStart));
nStart = nEnd + 1;
nEnd = source.Find(division,nStart);
}
nEnd = source.GetLength();
if(nStart < nEnd) dest.Add(source.Mid(nStart,nEnd - nStart));
}
(发表于2006-9-4 9:08:00)
zjh824:有函数的strtok可以分割的
(发表于2006-9-9 22:25:00)
..........................................................................
--------------------next---------------------
阅读(132) | 评论(0) | 转发(0) |