mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 08:48:49 +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:
parent
5ce9305c5f
commit
3ea65200d8
Notes:
sideshowbarker
2024-07-18 11:06:25 +09:00
Author: https://github.com/MaxWipfli
Commit: 3ea65200d8
Pull-request: https://github.com/SerenityOS/serenity/pull/8368
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/trflynn89
4 changed files with 41 additions and 36 deletions
|
@ -173,6 +173,16 @@ bool StringView::equals_ignoring_case(const StringView& other) const
|
|||
return StringUtils::equals_ignoring_case(*this, other);
|
||||
}
|
||||
|
||||
String StringView::to_lowercase_string() const
|
||||
{
|
||||
return StringImpl::create_lowercased(characters_without_null_termination(), length());
|
||||
}
|
||||
|
||||
String StringView::to_uppercase_string() const
|
||||
{
|
||||
return StringImpl::create_uppercased(characters_without_null_termination(), length());
|
||||
}
|
||||
|
||||
StringView StringView::substring_view_starting_from_substring(const StringView& substring) const
|
||||
{
|
||||
const char* remaining_characters = substring.characters_without_null_termination();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue