1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

LibWeb/Infra: Rename to_ascii_{{lower,upper}_case => {lower,upper}case}

This commit is contained in:
Linus Groh 2023-03-04 22:41:57 +00:00
parent 85507b34d7
commit f65cbeef5c
5 changed files with 12 additions and 12 deletions

View file

@ -33,7 +33,7 @@ bool is_ascii_case_insensitive_match(StringView a, StringView b)
auto b_char = *b_iterator;
++b_iterator;
if (to_ascii_lowercase(a_char) != to_ascii_lowercase(b_char))
if (AK::to_ascii_lowercase(a_char) != AK::to_ascii_lowercase(b_char))
return false;
}
@ -107,28 +107,28 @@ ErrorOr<String> convert_to_scalar_value_string(StringView string)
}
// https://infra.spec.whatwg.org/#ascii-lowercase
ErrorOr<String> to_ascii_lower_case(StringView string)
ErrorOr<String> to_ascii_lowercase(StringView string)
{
// To ASCII lowercase a string, replace all ASCII upper alphas in the string with their
// corresponding code point in ASCII lower alpha.
StringBuilder string_builder;
auto utf8_view = Utf8View { string };
for (u32 code_point : utf8_view) {
code_point = to_ascii_lowercase(code_point);
code_point = AK::to_ascii_lowercase(code_point);
TRY(string_builder.try_append(code_point));
}
return string_builder.to_string();
}
// https://infra.spec.whatwg.org/#ascii-uppercase
ErrorOr<String> to_ascii_upper_case(StringView string)
ErrorOr<String> to_ascii_uppercase(StringView string)
{
// To ASCII uppercase a string, replace all ASCII lower alphas in the string with their
// corresponding code point in ASCII upper alpha.
StringBuilder string_builder;
auto utf8_view = Utf8View { string };
for (u32 code_point : utf8_view) {
code_point = to_ascii_uppercase(code_point);
code_point = AK::to_ascii_uppercase(code_point);
TRY(string_builder.try_append(code_point));
}
return string_builder.to_string();