Answers for "vector string split string(string) meaning"

C++
0

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);
}
Posted by: Guest on October-15-2020

Browse Popular Code Answers by Language