string GetFileExt(string& strFile, int isLower)
{
if(isLower == 1)
{
string strTemp = strFile;
std::transform(strTemp.begin(), strTemp.end(), strTemp.begin(), ::tolower);
string::size_type pos = strTemp.rfind('.');
string strExt = strTemp.substr(pos == std::string::npos ? strTemp.length() : pos+1);
return strExt;
}
else
{
string::size_type pos = strFile.rfind('.');
string strExt = strFile.substr(pos == std::string::npos ? strFile.length() : pos+1);
return strExt;
}
}
从std::string中获取文件路径扩展名
最新推荐文章于 2025-03-24 00:00:00 发布