mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
Add endswith helper to string_utils
This commit is contained in:
committed by
Baldur Karlsson
parent
95225d12b4
commit
cced0e695b
@@ -99,3 +99,11 @@ std::string trim(const std::string &str)
|
||||
// searching from the start found something, so searching from the end must have too.
|
||||
return str.substr(start, end - start + 1);
|
||||
}
|
||||
|
||||
bool endswith(const std::string &value, const std::string &ending)
|
||||
{
|
||||
if(ending.length() > value.length())
|
||||
return false;
|
||||
|
||||
return (0 == value.compare(value.length() - ending.length(), ending.length(), ending));
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ std::string trim(const std::string &str);
|
||||
|
||||
uint32_t strhash(const char *str, uint32_t existingHash = 5381);
|
||||
|
||||
bool endswith(const std::string &value, const std::string &ending);
|
||||
|
||||
template <class strType>
|
||||
strType basename(const strType &path)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user