set<string> SplitString(string str)
{
set<string> split;
char *cstr = new char[str.length() + 1];
strcpy(cstr, str.c_str());
char *temp = strtok(cstr, ",");
while (temp)
{
split.insert(temp);
temp = strtok(NULL, ",");
}
return split;
}
vector<string> FindUnion(set<string> split, set<string> split1)
{
vector<string> result;
set<string>::iterator iter;
for (iter = split.begin(); iter != split.end(); iter++)
{
if (split1.count(*iter) == 1)
{
result.push_back(*iter);
}
}
return result;
}
找到两个字符串集合的交集
最新推荐文章于 2023-11-25 16:31:32 发布