mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +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
47 changed files with 108 additions and 102 deletions
|
@ -22,6 +22,11 @@ enum class CaseSensitivity {
|
|||
CaseSensitive,
|
||||
};
|
||||
|
||||
enum class ReplaceMode {
|
||||
All,
|
||||
FirstOnly,
|
||||
};
|
||||
|
||||
enum class TrimMode {
|
||||
Left,
|
||||
Right,
|
||||
|
@ -80,7 +85,7 @@ String to_snakecase(StringView);
|
|||
String to_titlecase(StringView);
|
||||
String invert_case(StringView);
|
||||
|
||||
String replace(StringView, StringView needle, StringView replacement, bool all_occurrences = false);
|
||||
String replace(StringView, StringView needle, StringView replacement, ReplaceMode);
|
||||
size_t count(StringView, StringView needle);
|
||||
|
||||
}
|
||||
|
@ -88,5 +93,6 @@ size_t count(StringView, StringView needle);
|
|||
}
|
||||
|
||||
using AK::CaseSensitivity;
|
||||
using AK::ReplaceMode;
|
||||
using AK::TrimMode;
|
||||
using AK::TrimWhitespace;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue