mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-10 13:12:56 +00:00
AK: Use an enum instead of a bool for String::replace(all_occurences)
This commit has no behavior changes. In particular, this does not fix any of the wrong uses of the previous default parameter (which used to be 'false', meaning "only replace the first occurence in the string"). It simply replaces the default uses by String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
This commit is contained in:
parent
b2454888e8
commit
7ceeb74535
Notes:
sideshowbarker
2024-07-17 09:40:48 +09:00
Author: https://github.com/Dexesttp
Commit: 7ceeb74535
Pull-request: https://github.com/SerenityOS/serenity/pull/14497
Reviewed-by: https://github.com/linusg ✅
47 changed files with 108 additions and 102 deletions
|
@ -146,8 +146,8 @@ struct UnicodeData {
|
|||
|
||||
static String sanitize_entry(String const& entry)
|
||||
{
|
||||
auto sanitized = entry.replace("-", "_", true);
|
||||
sanitized = sanitized.replace(" ", "_", true);
|
||||
auto sanitized = entry.replace("-", "_", ReplaceMode::All);
|
||||
sanitized = sanitized.replace(" ", "_", ReplaceMode::All);
|
||||
|
||||
StringBuilder builder;
|
||||
bool next_is_upper = true;
|
||||
|
@ -229,7 +229,7 @@ static ErrorOr<void> parse_special_casing(Core::Stream::BufferedFile& file, Unic
|
|||
|
||||
if (!casing.locale.is_empty())
|
||||
casing.locale = String::formatted("{:c}{}", to_ascii_uppercase(casing.locale[0]), casing.locale.substring_view(1));
|
||||
casing.condition = casing.condition.replace("_", "", true);
|
||||
casing.condition = casing.condition.replace("_", "", ReplaceMode::All);
|
||||
|
||||
if (!casing.condition.is_empty() && !unicode_data.conditions.contains_slow(casing.condition))
|
||||
unicode_data.conditions.append(casing.condition);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue