split a string into words c++ code example
Example: split string on character c++
#include <string> // std::string
#include <sstream> // std::stringstream
std::stringstream test("this_is_a_test_string");
std::string segment;
std::vector<std::string> seglist;
while(std::getline(test, segment, '_'))
{
seglist.push_back(segment);
}
// seglist = {"this", "is", "a", "test", "string"};