mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add FlyString::starts_with_bytes and FlyString::ends_with_bytes
Mirroring the API for String
This commit is contained in:
parent
1d8ec677a3
commit
8c8ea86729
Notes:
sideshowbarker
2024-07-17 01:46:00 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/8c8ea86729 Pull-request: https://github.com/SerenityOS/serenity/pull/21828
2 changed files with 14 additions and 0 deletions
|
@ -205,4 +205,14 @@ bool FlyString::equals_ignoring_ascii_case(StringView other) const
|
|||
return StringUtils::equals_ignoring_ascii_case(bytes_as_string_view(), other);
|
||||
}
|
||||
|
||||
bool FlyString::starts_with_bytes(StringView bytes, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
return bytes_as_string_view().starts_with(bytes, case_sensitivity);
|
||||
}
|
||||
|
||||
bool FlyString::ends_with_bytes(StringView bytes, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
return bytes_as_string_view().ends_with(bytes, case_sensitivity);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,6 +69,10 @@ public:
|
|||
[[nodiscard]] bool equals_ignoring_ascii_case(FlyString const&) const;
|
||||
[[nodiscard]] bool equals_ignoring_ascii_case(StringView) const;
|
||||
|
||||
[[nodiscard]] bool starts_with_bytes(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
|
||||
[[nodiscard]] bool ends_with_bytes(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
|
||||
template<typename... Ts>
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts... strings) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue