my problem is that I have defined a string like so:
string messages = "This is an option; This is a really long option; Another One For Testing Sake; This is the last one I swear; You lied to me!";
The ';' characters in the string are to be treated like delimiters. In the grand scheme of things this string is called into a function res.addMessages(messages);
The code for which is:
void ConflictResMenu::addMessages(string messages) {
int idx = 0;
for (int i = 0; i < messages.length(); i++) {
cout << messages.find_first_of(';') << endl;
if (messages[i] == this->delim) {
this->split_messages.push_back(messages.substr(idx, i));
idx = i + 1;
}
}
}
The problem with this is that the if clause is called at all the wrong times so the output ends up like:
This is an option
This is a really long option; Another One For
Another One For Testing Sake; This is the last one I swear; You lied to me!
This is the last one I swear; You lied to me!
I honestly have no idea what is going on here. If anyone can help or suggest a better way of approaching this, I would be very grateful.