mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:57:35 +00:00
Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
This commit is contained in:
parent
3f3f45580a
commit
c8585b77d2
86 changed files with 283 additions and 283 deletions
|
@ -30,7 +30,7 @@ String Color::to_string_without_alpha() const
|
|||
static Optional<Color> parse_rgb_color(StringView string)
|
||||
{
|
||||
VERIFY(string.starts_with("rgb("sv, CaseSensitivity::CaseInsensitive));
|
||||
VERIFY(string.ends_with(")"));
|
||||
VERIFY(string.ends_with(')'));
|
||||
|
||||
auto substring = string.substring_view(4, string.length() - 5);
|
||||
auto parts = substring.split_view(',');
|
||||
|
@ -51,7 +51,7 @@ static Optional<Color> parse_rgb_color(StringView string)
|
|||
static Optional<Color> parse_rgba_color(StringView string)
|
||||
{
|
||||
VERIFY(string.starts_with("rgba("sv, CaseSensitivity::CaseInsensitive));
|
||||
VERIFY(string.ends_with(")"));
|
||||
VERIFY(string.ends_with(')'));
|
||||
|
||||
auto substring = string.substring_view(5, string.length() - 6);
|
||||
auto parts = substring.split_view(',');
|
||||
|
@ -252,10 +252,10 @@ Optional<Color> Color::from_string(StringView string)
|
|||
return Color::from_rgb(web_colors[i].color);
|
||||
}
|
||||
|
||||
if (string.starts_with("rgb("sv, CaseSensitivity::CaseInsensitive) && string.ends_with(")"))
|
||||
if (string.starts_with("rgb("sv, CaseSensitivity::CaseInsensitive) && string.ends_with(')'))
|
||||
return parse_rgb_color(string);
|
||||
|
||||
if (string.starts_with("rgba("sv, CaseSensitivity::CaseInsensitive) && string.ends_with(")"))
|
||||
if (string.starts_with("rgba("sv, CaseSensitivity::CaseInsensitive) && string.ends_with(')'))
|
||||
return parse_rgba_color(string);
|
||||
|
||||
if (string[0] != '#')
|
||||
|
|
|
@ -356,7 +356,7 @@ String BitmapFont::variant() const
|
|||
if (builder.string_view() == "Regular"sv)
|
||||
builder.clear();
|
||||
else
|
||||
builder.append(" ");
|
||||
builder.append(' ');
|
||||
builder.append(slope_to_name(slope()));
|
||||
}
|
||||
return builder.to_string();
|
||||
|
|
|
@ -231,7 +231,7 @@ String Path::to_string() const
|
|||
|
||||
builder.append(") "sv);
|
||||
}
|
||||
builder.append("}");
|
||||
builder.append('}');
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue