vector<string> split(string& str, char ch)//字符串分割函数
    vector<string> res;
    str += ch;
    int start = 0;
    int last = str.find(ch);
    while (last < str.size())
        if (start != last)
            res.push_back(str.substr(start, last - start));
        start = last + 1;
        last = str.find(ch, start);
    return res;

2 Replies to “Split函数封装”

  1. Nice post. I was checking continuously this
    blog and I’m impressed! Very useful information particularly the
    last part 🙂 I care for such information much.
    I was seeking this certain info for a long time. Thank you and best of luck.


电子邮件地址不会被公开。 必填项已用*标注