//
// 切割字符串
//
void CCStringPro::SplitString(CString strSource, CString strSplit, CStringArray& arrayStrDest)
{
arrayStrDest.RemoveAll();
int pos = 0;
int pre_pos = 0;
while( -1 != pos )
{
pre_pos = pos;
pos = strSource.Find(strSplit);
CString strTemp("");
if(pos==-1)
{
strTemp = strSource.Mid(0);
}
else
{
strTemp = strSource.Mid(0, pos);
}
strSource = strSource.Mid(pos+1);
arrayStrDest.Add(strTemp);
}
}
C++字符串切割方法
本文介绍了一种使用C++实现的字符串切割方法,通过查找指定的分隔符并将其从原始字符串中移除来实现字符串的切割。此方法适用于需要将长字符串分割成多个子串的应用场景。
1479

被折叠的 条评论
为什么被折叠?



