📜  C++ 按空格将字符串拆分为向量 - C++ 代码示例

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

代码示例2
std::string s = "What is the right way to split a string into a vector of strings";
std::stringstream ss(s);
std::istream_iterator begin(ss);
std::istream_iterator end;
std::vector vstrings(begin, end);
std::copy(vstrings.begin(), vstrings.end(), std::ostream_iterator(std::cout, "\n"));