Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. std::vector<String> String::split(char ch) const {
  2. std::vector<String> result;
  3. String tmp;
  4.  
  5. for(int i = 0; str[i] != '\0'; ++i){
  6. if(str[i] != ch) {
  7. tmp = tmp + str[i];
  8. }
  9. else {
  10. tmp.str[i] = '\0';
  11. result.push_back(tmp);
  12. // Burn through any other split characters.
  13. while( str[i] == ch )
  14. ++i;
  15. tmp = str[++i];
  16. }
  17. }
  18. result.push_back(tmp);
  19. return(result);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement