Commit d0349880 authored by Max Kellermann's avatar Max Kellermann

util/StringCompare: add StringAfterPrefixIgnoreCase()

parent f1781632
...@@ -81,6 +81,15 @@ StringStartsWithIgnoreCase(const char *haystack, StringView needle) noexcept ...@@ -81,6 +81,15 @@ StringStartsWithIgnoreCase(const char *haystack, StringView needle) noexcept
return StringIsEqualIgnoreCase(haystack, needle.data, needle.size); return StringIsEqualIgnoreCase(haystack, needle.data, needle.size);
} }
gcc_pure gcc_nonnull_all
static inline const char *
StringAfterPrefixIgnoreCase(const char *haystack, StringView needle) noexcept
{
return StringStartsWithIgnoreCase(haystack, needle)
? haystack + needle.size
: nullptr;
}
/** /**
* Check if the given string ends with the specified suffix. If yes, * Check if the given string ends with the specified suffix. If yes,
* returns the position of the suffix, and nullptr otherwise. * returns the position of the suffix, and nullptr otherwise.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment