Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::vector<String> String::split(char ch) const {
- std::vector<String> result;
- String tmp;
- for(int i = 0; str[i] != '\0'; ++i){
- if(str[i] != ch) {
- tmp = tmp + str[i];
- }
- else {
- tmp.str[i] = '\0';
- result.push_back(tmp);
- // Burn through any other split characters.
- while( str[i] == ch )
- ++i;
- tmp = str[++i];
- }
- }
- result.push_back(tmp);
- return(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement