自己写了的一个Split函数,用用于切割字符串
vector<CString> Split(CString source, CString division)
{
int iLen = source.GetLength() ;
int iDivLen = division.GetLength() ;
vector<CString> v;
int pos = 0;
int pre_pos = 0;
while( -1 != pos )
{
pre_pos = pos ?pos + iDivLen :pos;
pos = source.Find(division,pre_pos);
if(pos != -1)
{
v.push_back((source.Mid(pre_pos,(pos - pre_pos ))));
}
if(pos == -1 && pre_pos < iLen)
{ v.push_back((source.Mid(pre_pos,(iLen - pre_pos)))); }
}
return v ;
}
CString str = "~0~91071098~~~010529010101~38514521~13~" ;
vector<CString> v = Split(str,"~~") ;