标签:
vector<CString> SplitCString(CString strSource, CString ch)
{
vector <CString> vecString;
int iPos = 0;
CString strTmp;
strTmp = strSource.Tokenize(ch,iPos);
while(strTmp.Trim() != _T(""))
{
vecString.push_back(strTmp);
strTmp = strSource.Tokenize(ch,iPos);
}
return vecString;
}
vector<CString> SplitCString(CString strSource, char ch)
{
CString strTmp;
vector<CString> vecString;
int n=-1;
n=strSource.Find(ch);
while(n!=-1)
{
strTmp=strSource.Left(n)
vecString.push_back(strTmp);
strSource=strsource.left(strSource.Getlenth-n+1)
n=strSource.Find(ch);
}
return vecString;
}
vector<CString> SplitCString(CString strSource, char ch)
{
CString strTmp;
vector<CString> vecString;
int iPos=0;
while(AfxExtractSubString(strTmp,strSource,iPos,ch))
{
iPos++;
vecString.push_back(strTmp);
}
return vecString;
}
vector<CString> SplitCString(CString strSource, char ch)
{
vector<CString> vecString;
CString strTmp=strtok((LPSTR)(LPCTSTR)strSource,ch);//(LPSTR)(LPCTSTR)将CString转char*
while(1)
{
strTmp=strtok(NULL,ch);
if (strTmp==_T(""))
break;
strTmp.TrimLeft();
vecString.push_back(strTmp);
}
}
MFC分隔字符串的四种方法
标签:
原文地址:http://www.cnblogs.com/cqhstyle/p/4777516.html