How would I split a string based on another substring in a simple way?
e.g. split on \"\\r\\n\"
message1\\r\\nmessage2
=>
It's a huge dependency, but I personally like Boost::Tokenizer.
From the example on the page:
// simple_example_1.cpp
#include
#include
#include
int main(){
using namespace std;
using namespace boost;
string s = "This is, a test";
tokenizer<> tok(s);
for(tokenizer<>::iterator beg=tok.begin(); beg!=tok.end();++beg){
cout << *beg << "\n";
}
}