i´m trying to figure out a substring between two different characters. the string looks like:
channelBlock_0\d_off_mux=8, 8, 8, 8, 8, 8, 8, 8
channelBlock_0\d_selvth=true, true, true, true, true, true, true, true
i want to split after the '='
and before the first ','
cutting after '='
already works for me... here´s what i got:
std::string line; //contains the string from above
std::string startDel = "=";
std::string endDel = ",";
cout << line.substr(line.find(startDel)+1,line.find(endDel));
my output looks like this:
8, 8, 8, 8, 8, 8, 8, 8
true, true, true, true, true
how can i cut after the first ',' so my output is just
8
true
After checking
substring()
, you can see that what you need is:since the second argument of the method states: