1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

AK: Implement StringView::to_{lower,upper}case_string

This patch refactors StringImpl::to_{lower,upper}case to use the new
static methods StringImpl::create_{lower,upper}cased if they have to use
to create a new StringImpl. This allows implementing StringView's
to_{lower,upper}case_string using the same methods.

It also replaces the usage of hand-written to_ascii_lowercase() and
similar methods with those from CharacterTypes.h.
This commit is contained in:
Max Wipfli 2021-07-01 13:45:59 +02:00 committed by Andreas Kling
parent 5ce9305c5f
commit 3ea65200d8
4 changed files with 41 additions and 36 deletions

View file

@ -83,6 +83,9 @@ public:
[[nodiscard]] StringView trim(const StringView& characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); }
[[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); }
[[nodiscard]] String to_lowercase_string() const;
[[nodiscard]] String to_uppercase_string() const;
Optional<size_t> find_first_of(char) const;
Optional<size_t> find_first_of(const StringView&) const;