Horje
C++ Split String By Space into Vector Code Example
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, "\n"));
split string on character vector C++
string s, tmp; 
stringstream ss(s);
vector<string> words;

// If there is one element (so komma) then push the whole string
if(getline(ss, tmp, ',').fail()) {
  words.push_back(s);
}
while(getline(ss, tmp, ',')){
    words.push_back(tmp);
}




Cpp

Related
ue4 c++ enumaeration Code Example ue4 c++ enumaeration Code Example
how to display a variable in c++ Code Example how to display a variable in c++ Code Example
right side pattern triangle   c++ Code Example right side pattern triangle c++ Code Example
c++ check if cin didn't get int Code Example c++ check if cin didn't get int Code Example
how to use sleep function in c++ windows Code Example how to use sleep function in c++ windows Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8