void MySplitFunc(const string & sourceStr , const char * delimeter , vector<string> & result_container)
{
result_container.empty();
if (sourceStr.length() == 0)return;
int iLen = sourceStr.length();
char * buffer = new char[iLen + 1];
strcpy(buffer , sourceStr.c_str());
buffer[iLen] = '\0';
char * p = strtok(buffer , delimeter);
while( p != NULL)
{
result_container.push_back(p);
p = strtok(NULL , delimeter);
}
delete [] buffer;
}
将字符串分割
最新推荐文章于 2022-05-16 08:22:44 发布