|
| CODE | std::vector<std::string> explode(std::string str,char delimeter) { std::vector<std::string> array (1); array[0]=""; unsigned int position,index; position=0; index=0; while (position<str.length()-1) { if (str[position]==delimeter) { index++; array.resize(index+1); array[index]=""; position++; } array[index]+=str[position]; position++; } } |
I know it's inefficient, and there's probably a better method. It works until it writes the last character, then the application crashes.
This post has been edited by RetroXYZ on Sep 24 2009, 07:34 PM
|