Analize this code:
Code:
string hyperlink = "<a href=http://www.ilovedonuts.com>Donut World!!</a>";
string beginStr = "http://", endStr = ".com";
unsigned int beginPos = hyperlink.find(beginStr), endPos = hyperlink.find(endStr), invalidPos = hyperlink.npos;
if (beginPos != invalidPos && endPos != invalidPos && endPos > beginPos)
{
unsigned int urlLen = endPos - beginPos + endStr.length();
string urlStr = hyperlink.substr(beginPos, urlLen);
cout << "Found URL " << urlStr;
}
else
{
cout << "No valid URL found";
}