VC++ 依据特定字符拆分字符串
2018-05-27
0 0 0
暂无评分
其他
如何获取积分?
int CFileFun::SplitCString(CString strIn, CStringArray& strAryRe, LPCTSTR lpstr)
{
ASSERT(lpstr);
strAryRe.RemoveAll();
int len1 = strIn.GetLength();
int len2 = _tcslen(lpstr);
if (0 == len1 || 0 == len2)
{
return 0;
}
int pos1 = 0, pos2 = 0;
while ((pos2 = strIn.Find(lpstr, pos1)) != -1)
{
strAryRe.Add(strIn.Mid(pos1, pos2 - pos1));
pos1 = pos2 + len2;
}
//加上最一个...
if (len1 > pos1 + 1)
{
strAryRe.Add(strIn.Mid(pos1));
}
return strAryRe.GetSize();
}
{
ASSERT(lpstr);
strAryRe.RemoveAll();
int len1 = strIn.GetLength();
int len2 = _tcslen(lpstr);
if (0 == len1 || 0 == len2)
{
return 0;
}
int pos1 = 0, pos2 = 0;
while ((pos2 = strIn.Find(lpstr, pos1)) != -1)
{
strAryRe.Add(strIn.Mid(pos1, pos2 - pos1));
pos1 = pos2 + len2;
}
//加上最一个...
if (len1 > pos1 + 1)
{
strAryRe.Add(strIn.Mid(pos1));
}
return strAryRe.GetSize();
}
相关源码推荐
使用Java开发Android AOA Android开放式附件
0
0
暂无评分
Golang AOA Android开放式附件HID控制
0
0
暂无评分
pclite
0
0
暂无评分
GMSK线性接收机
0
0
暂无评分
传世AFT中变打金版版本--以前很火爆的,收藏很久
0
0
暂无评分
暂无评论