Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
- vector<string>& splitWithWS(string toSplit){
- vector<string> res;
- size_t first = str.find_first_not_of(' ');
- size_t last = str.find_last_not_of(' ');
- if(first != string::npos){
- toSplit = toSplit.substr(first, last-first+1);
- }
- while(toSplit.find(' ')!=string::npos){
- size_t firstSpace = toSplit.find_first_of(' ');
- res.push_back(toSplit.substr(0,firstSpace));
- toSplit=toSplit.substr(firstSpace);
- size_t secondSpace = toSplit.find_first_not_of(' ');
- toSplit=toSplit.substr(secondSpace);
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement