📜  c++ 通过 sstream 分割字符串 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:48.006000             🧑  作者: Mango

代码示例2
std::vector &split(const std::string &s, char delim, std::vector &elems) {
    std::stringstream ss(s);
    std::string item;
    while(std::getline(ss, item, delim)) {
        elems.push_back(item);
    }
    return elems;
}