summaryrefslogtreecommitdiff
path: root/AK/StringUtils.h
diff options
context:
space:
mode:
authordemostanis <demostanis@protonmail.com>2022-10-22 15:38:21 +0200
committerLinus Groh <mail@linusgroh.de>2022-10-24 23:29:18 +0100
commit3e8b5ac92012e19847e536a20a3f0ec7e5c787d3 (patch)
tree58294f8f5e5eeaa63231876148da783ca81015eb /AK/StringUtils.h
parentf485db2501c32bd626d58973c8a34a81e09ca5dc (diff)
downloadserenity-3e8b5ac92012e19847e536a20a3f0ec7e5c787d3.zip
AK+Everywhere: Turn bool keep_empty to an enum in split* functions
Diffstat (limited to 'AK/StringUtils.h')
-rw-r--r--AK/StringUtils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/AK/StringUtils.h b/AK/StringUtils.h
index 10b9952516..60dde9c359 100644
--- a/AK/StringUtils.h
+++ b/AK/StringUtils.h
@@ -8,6 +8,7 @@
#pragma once
#include <AK/Concepts.h>
+#include <AK/EnumBits.h>
#include <AK/Forward.h>
namespace AK {
@@ -38,6 +39,14 @@ enum class TrimWhitespace {
No,
};
+enum class SplitBehavior : unsigned {
+ Nothing = 0,
+ // If two separators follow each other without any characters
+ // in between, keep a "" in the resulting vector.
+ KeepEmpty = 1,
+};
+AK_ENUM_BITWISE_OPERATORS(SplitBehavior);
+
struct MaskSpan {
size_t start;
size_t length;
@@ -99,5 +108,6 @@ size_t count(StringView, StringView needle);
using AK::CaseSensitivity;
using AK::ReplaceMode;
+using AK::SplitBehavior;
using AK::TrimMode;
using AK::TrimWhitespace;