1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +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

@ -26,6 +26,9 @@ public:
static RefPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp);
static RefPtr<StringImpl> create(const char* cstring, size_t length, ShouldChomp = NoChomp);
static RefPtr<StringImpl> create(ReadonlyBytes, ShouldChomp = NoChomp);
static RefPtr<StringImpl> create_lowercased(char const* cstring, size_t length);
static RefPtr<StringImpl> create_uppercased(char const* cstring, size_t length);
NonnullRefPtr<StringImpl> to_lowercase() const;
NonnullRefPtr<StringImpl> to_uppercase() const;