有没有好的方法来存储字符串,就是将一个长的字符串截取子串,每四个字符为一个子串,然后将各个子串进行存储
我用CArray试了,存在内存泄露问题,请教
关键代码如下:
CArray<CString,CString&> card;
//截取字符串
CString strMid;
strMid=ReturnStr.Mid(30);
//除去字符串中的空格
strMid.Remove(' ');
int strlen=strMid.GetLength();
//截取卡号部分
strMid=strMid.Left(strlen-4);

//每四个字符为一个卡号,将其存入CArray定义的字符串数组里
//////////////
//设置数组大小
card.SetSize(strMid.GetLength()/4);
card.RemoveAll();
for(int i=0;i<strMid.GetLength();i+=4)
{
    card.Add(strMid.Mid(i,4));
}