mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
AK: Add FlyString::equals_ignoring_ascii_case()
This is similar to equals_ignoring_case() but only cares about ASCII case insensitivity.
This commit is contained in:
parent
b78ee64415
commit
629b6462dc
Notes:
sideshowbarker
2024-07-17 11:06:06 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/629b6462dc Pull-request: https://github.com/SerenityOS/serenity/pull/17763 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico
@ -178,4 +178,12 @@ ErrorOr<void> Formatter<FlyString>::format(FormatBuilder& builder, FlyString con
|
|||||||
return Formatter<StringView>::format(builder, fly_string.bytes_as_string_view());
|
return Formatter<StringView>::format(builder, fly_string.bytes_as_string_view());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FlyString::equals_ignoring_ascii_case(FlyString const& other) const
|
||||||
|
{
|
||||||
|
if (*this == other)
|
||||||
|
return true;
|
||||||
|
// FIXME: Rename StringUtils::equals_ignoring_case to equals_ignoring_ascii_case.
|
||||||
|
return StringUtils::equals_ignoring_case(bytes_as_string_view(), other.bytes_as_string_view());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,9 @@ public:
|
|||||||
// FIXME: Remove this once all code has been ported to FlyString
|
// FIXME: Remove this once all code has been ported to FlyString
|
||||||
[[nodiscard]] DeprecatedFlyString to_deprecated_fly_string() const;
|
[[nodiscard]] DeprecatedFlyString to_deprecated_fly_string() const;
|
||||||
|
|
||||||
|
// Compare this FlyString against another string with ASCII caseless matching.
|
||||||
|
[[nodiscard]] bool equals_ignoring_ascii_case(FlyString const&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This will hold either the pointer to the Detail::StringData it represents or the raw bytes of
|
// This will hold either the pointer to the Detail::StringData it represents or the raw bytes of
|
||||||
// an inlined short string.
|
// an inlined short string.
|
||||||
|
Loading…
Reference in New Issue
Block a user