📅  最后修改于: 2022-03-11 14:44:58.685000             🧑  作者: Mango
#include
#include
#include
using namespace std;
int main() {
std::stringstream str_strm("Hello from the dark side");
std::string tmp;
vector words;
char delim = ' '; // Ddefine the delimiter to split by
while (std::getline(str_strm, tmp, delim)) {
// Provide proper checks here for tmp like if empty
// Also strip down symbols like !, ., ?, etc.
// Finally push it.
words.push_back(tmp);
}
}