Create stringtool.hpp
This commit is contained in:
parent
f7f0d26896
commit
a15b0bdb2d
11
internal/stringtool.hpp
Normal file
11
internal/stringtool.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user