I've been trying to break up a string that has a delimiter, in this case it is a comma.
int main()
{
string test = "12345,768,11,987,567812";
int temp = 0;
for (int i = 0; i < test.size(); i++) {
if (test[i] == ',') {
cout << test.substr(temp, i) << endl;
temp = i+1;
}
}
return 0;
}
This is the code I have so far. The first string gets broken up correctly but after that it doesn't work and I'm not sure why.