util/StringView: add StartsWithIgnoreCase(), EndsWithIgnoreCase()
This commit is contained in:
parent
21b81dfb1d
commit
0f1e13d9ff
@ -127,6 +127,19 @@ struct BasicStringView : ConstBuffer<T> {
|
||||
StringIsEqual(data, other.data, this->size);
|
||||
}
|
||||
|
||||
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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user