Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #split #string #character #vector
ADD COMMENT
Topic
Name
4+4 =