Chinaunix首页 | 论坛 | 博客
  • 博客访问: 379445
  • 博文数量: 715
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5005
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 14:46
文章分类

全部博文(715)

文章存档

2011年(1)

2008年(714)

我的朋友

分类:

2008-10-13 16:35:34

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) |
给主人留下些什么吧!~~