mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Add contains(char) method to String
This commit is contained in:
parent
a29788e58a
commit
7a9d05c24c
Notes:
sideshowbarker
2024-07-18 07:06:05 +09:00
Author: https://github.com/boricj Commit: https://github.com/SerenityOS/serenity/commit/7a9d05c24c6 Pull-request: https://github.com/SerenityOS/serenity/pull/9344 Reviewed-by: https://github.com/alimpfard
2 changed files with 6 additions and 0 deletions
|
@ -341,6 +341,11 @@ bool String::contains(const StringView& needle, CaseSensitivity case_sensitivity
|
|||
return StringUtils::contains(*this, needle, case_sensitivity);
|
||||
}
|
||||
|
||||
bool String::contains(char needle, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity);
|
||||
}
|
||||
|
||||
bool String::equals_ignoring_case(const StringView& other) const
|
||||
{
|
||||
return StringUtils::equals_ignoring_case(view(), other);
|
||||
|
|
|
@ -138,6 +138,7 @@ public:
|
|||
[[nodiscard]] bool equals_ignoring_case(const StringView&) const;
|
||||
|
||||
[[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
[[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
||||
|
||||
[[nodiscard]] Vector<String> split_limit(char separator, size_t limit, bool keep_empty = false) const;
|
||||
[[nodiscard]] Vector<String> split(char separator, bool keep_empty = false) const;
|
||||
|
|
Loading…
Reference in a new issue