renderd7/internal/stringtool.hpp

12 lines
314 B
C++
Raw Permalink Normal View History

2021-08-12 22:17:46 +02:00
template<class T>
T GetFileName(T const & path, T const & delims = "/\\")
{
return path.substr(path.find_last_of(delims) + 1);
}
template<class T>
T remove_ext(T const & filename)
{
typename T::size_type const p(filename.find_last_of('.'));
return p > 0 && p != T::npos ? filename.substr(0, p) : filename;
}