CString temp;
vector<CString>v1
str.Replace(_T(";"), _T(";"));//防止中英文分号混淆,统一把英文分号替换成中文分号
int bj = 0;
int ej = 0;
while (ej = str.Find(_T(";"), bj))
{
if (ej < 1)
{
if (bj <= str.GetLength())//排除末尾没加分号的情况
{
temp =str.Mid(bj, str.GetLength());
v1.push_back(temp);
}
break;
}
temp = str.Mid(bj, ej - bj);
v1.push_back(temp);
bj = ej + 1;
ej = 0;
}
按照分号分割字符串
最新推荐文章于 2022-05-06 17:29:58 发布