std::string SplitHostDomain(const std::string& str)
{
if (!!str.compare(0,5,"http:"))
{
size_t found = str.find_first_of("/\\");
std::string str1 = str.substr(found + 2);
found = str1.find_first_of("/\\");
found = str1.find_first_of(":");
return (str1.substr(0, found));
}
else{
size_t found = str.find_first_of("/\\");
found = str.find_first_of(":");
return (str.substr(0, found));
}
}
printf("%s\n", splitFileName("http://www.baidu.com/test/1").c_str());
printf("%s\n", splitFileName("www.baidu.com/test/1").c_str());