Skip to content
Snippets Groups Projects
Commit 9d83b34d authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov
Browse files

Add dropFileExtension() and findLastDot().

parent 8a93e7e2
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,20 @@ size_t findLastPathSeparator(std::string const& path)
return path.find_last_of("/\\");
}
size_t findLastDot(std::string const& path)
{
return path.find_last_of(".");
}
std::string dropFileExtension(std::string const& filename)
{
const size_t p = findLastDot(filename);
if (p == std::string::npos)
return filename;
return filename.substr(0, filename.length() - p);
}
std::string getFileNameFromPath(const std::string &str, bool with_extension)
{
std::string::size_type beg1 = str.find_last_of('/');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment