util/StringCompare: add StringEndsWithIgnoreCase(), StringStartsWithIgnoreCase()
This commit is contained in:
@@ -56,6 +56,10 @@ gcc_pure gcc_nonnull_all
|
||||
bool
|
||||
StringEndsWith(const char *haystack, const char *needle) noexcept;
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
bool
|
||||
StringEndsWithIgnoreCase(const char *haystack, const char *needle) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the portion of the string after a prefix. If the string
|
||||
* does not begin with the specified prefix, this function returns
|
||||
@@ -70,6 +74,13 @@ StringAfterPrefix(const char *haystack, StringView needle) noexcept
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static inline bool
|
||||
StringStartsWithIgnoreCase(const char *haystack, StringView needle) noexcept
|
||||
{
|
||||
return StringIsEqualIgnoreCase(haystack, needle.data, needle.size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given string ends with the specified suffix. If yes,
|
||||
* returns the position of the suffix, and nullptr otherwise.
|
||||
|
||||
Reference in New Issue
Block a user