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

全部博文(724)

文章存档

2011年(1)

2008年(723)

我的朋友

分类:

2008-10-13 17:23:59


有函数的strtok可以分割的 ( zjh824 发表于 2006-9-9 22:25:00)

这位兄弟精神可嘉。

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));
}
( genghz 发表于 2006-9-4 9:08:00)

兄弟。。。。
MFC有一个未列入文档的函数AfxExtractSubString(CString& rString, LPCTSTR lpszFullString,int iSubString, TCHAR chSep = '\n'),很好用的!
不用这么麻烦! ( dylan_ding 发表于 2006-8-16 17:56:00)


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;

} ( pepperdiyu 发表于 2006-8-15 13:04:00)

.......................................................

--------------------next---------------------

阅读(203) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~