vector<string> split(const string &str,const string &pattern)
{ //const char* convert to char*
char * strc = new char[strlen(str.c_str())+1];
strcpy(strc, str.c_str());
vector<string> resultVec; char* tmpStr = strtok(strc, pattern.c_str()); while (tmpStr != NULL)
{
resultVec.push_back(string(tmpStr));
tmpStr = strtok(NULL, pattern.c_str());
} delete[] strc; return resultVec;
}
按指定字符拆分字符串