|
I will give you a method that can solve the problem well, but the answer that I gave you that day was not very good. Now I will give you a complete solution
CString str = "#abcd#a#gf#eee";
int Len=str.GetLength();
int Len1;
CString strTemp[10];
int i=0;
while((Len1=str.Find("#"))>=0)
{
strTemp[i]=str.Left(Len1);
str=str.Right(Len-Len1-1);
Len=str.GetLength();
AfxMessageBox(strTemp[i]);
i++;
}
AfxMessageBox(str);
At this time: strTemp[0],strTemp[1],strTemp[2],strTemp[3],str are "","abcd","a","gf","eee" respectively |
|