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:
DexesTTP 2022-07-05 22:33:15 +02:00 committed by Linus Groh
parent b2454888e8
commit 7ceeb74535
Notes: sideshowbarker 2024-07-17 09:40:48 +09:00
47 changed files with 108 additions and 102 deletions

View file

@ -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);