I am trying to parse a string which contains a line of my XML file.
std::string temp = "<Album>Underclass Hero</Album>";
int f = temp.find(">");
int l = temp.find("</");
std::string _line = temp.substr(f + 1, l-2);
This is a part of my code of my function which should actually return the parsed string. What I expected was that it returns Underclass Hero. Instead I got Underclass Hero< /Alb
(here is between the '<' and '/' a space because I couldn't write them together).
I looked std::string::find several times up and it always said it returns, if existing, the position of the first character of the first match. Here it gives me the last character of the string, but only in my variable l.
f does fine.
So can anyone tell me what I'm doing wrong?