Commit 0f1e13d9 authored by Max Kellermann's avatar Max Kellermann

util/StringView: add StartsWithIgnoreCase(), EndsWithIgnoreCase()

parent 21b81dfb
......@@ -128,6 +128,19 @@ struct BasicStringView : ConstBuffer<T> {
}
gcc_pure
bool StartsWithIgnoreCase(BasicStringView<T> needle) const noexcept {
return this->size >= needle.size &&
StringIsEqualIgnoreCase(data, needle.data, needle.size);
}
gcc_pure
bool EndsWithIgnoreCase(BasicStringView<T> needle) const noexcept {
return this->size >= needle.size &&
StringIsEqualIgnoreCase(data + this->size - needle.size,
needle.data, needle.size);
}
gcc_pure
bool EqualsIgnoreCase(BasicStringView<T> other) const noexcept {
return this->size == other.size &&
StringIsEqualIgnoreCase(data, other.data, this->size);
......
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