Add helper functions to get last path segment

This commit is contained in:
Jonathan G Rennison
2024-01-05 22:13:17 +00:00
parent 7fdcbced09
commit 0ab4b8ea31
5 changed files with 22 additions and 15 deletions

View File

@@ -66,6 +66,13 @@ bool strtolower(std::string &str, std::string::size_type offs = 0);
[[nodiscard]] bool StrValid(const char *str, const char *last) NOACCESS(2);
void StrTrimInPlace(std::string &str);
const char *StrLastPathSegment(const char *path);
inline const char *StrLastPathSegment(const std::string &path)
{
return StrLastPathSegment(path.c_str());
}
[[nodiscard]] bool StrStartsWith(const std::string_view str, const std::string_view prefix);
[[nodiscard]] bool StrStartsWithIgnoreCase(std::string_view str, const std::string_view prefix);
[[nodiscard]] bool StrEndsWith(const std::string_view str, const std::string_view suffix);