Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ Split String By Space into Vector

std::string s = "What is the right way to split a string into a vector of strings";
std::stringstream ss(s);
std::istream_iterator<std::string> begin(ss);
std::istream_iterator<std::string> end;
std::vector<std::string> vstrings(begin, end);
std::copy(vstrings.begin(), vstrings.end(), std::ostream_iterator<std::string>(std::cout, "
"));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Split #String #By #Space #Vector
ADD COMMENT
Topic
Name
1+2 =