c++ 字符窜切割

std::vector<std::string> Tools::SplitStr(const char* baseStr, const char* rule)
{
    log("baseStr: %s",baseStr);
    std::vector<std::string> tempList;

    std::string str;
    char* item;
    item = strtok((char*)baseStr, rule);
    while (item)
    {
        str = item;
     log("item: %s", str.c_str());
tempList.push_back(str); item = strtok(NULL, rule); } return tempList; }

 

posted @ 2015-02-26 16:03  居家懒人  阅读(183)  评论(0)    收藏  举报