Advertisement
MatveyL

split c++

Nov 8th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. vector<string>split(string s, char sp){
  2. string p = "";
  3. vector<string> splited;
  4.  
  5. for (int i = 0; i < int(s.size()); ++i){
  6. if (s[i] == sp){
  7. splited.push_back(p);
  8. p = "";
  9. }else{
  10. p += s[i];
  11. }
  12. }
  13. splited.push_back(p);
  14. return splited;
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement