Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4. std::cout << "Hello, World!" << std::endl;
  5. return 0;
  6. }
  7.  
  8. vector<string>& splitWithWS(string toSplit){
  9. vector<string> res;
  10. size_t first = str.find_first_not_of(' ');
  11. size_t last = str.find_last_not_of(' ');
  12. if(first != string::npos){
  13. toSplit = toSplit.substr(first, last-first+1);
  14. }
  15. while(toSplit.find(' ')!=string::npos){
  16. size_t firstSpace = toSplit.find_first_of(' ');
  17. res.push_back(toSplit.substr(0,firstSpace));
  18. toSplit=toSplit.substr(firstSpace);
  19. size_t secondSpace = toSplit.find_first_not_of(' ');
  20. toSplit=toSplit.substr(secondSpace);
  21. }
  22. return res;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement