void splitBy(string read,const char* fenhao,const char* douhao,CCArray *disArray)
{
str_replace(read, ",", ",");
str_replace(read, " ", "");
str_replace(read, "\n", "");
vector<string> tempArray1 = split(read.c_str(), fenhao);
vector<string>::iterator tempit1 = tempArray1.begin();
for (tempit1 = tempArray1.begin(); tempit1 != tempArray1.end(); tempit1++) {
const char *tempChar = CCString::create(*tempit1)->getCString();
// CCLOG("tempChar:%s",tempChar);
CCArray *splitArray = CCArray::create();
splitBy(tempChar, douhao, splitArray);
disArray->addObject(splitArray);
}
}
逗号和分号分割字符串
最新推荐文章于 2024-01-29 11:16:36 发布