Hello people,
can anyone explain me why output from this program
is: "This is test!"(without quotes)?Code:#include <iostream> #include <string> using namespace std; int main() { string str = "This is, you shouldn't see this, just a test!"; string :: size_type start, end; string delim = ","; start = str.find(delim); if (start == string::npos) { return 0; } end = str.find(delim, start+delim.length()); str.erase(start, end+delim.length()); cout << str; return 0; }
I expected that characters between ',' (including them) would be removed.



LinkBack URL
About LinkBacks


