summaryrefslogtreecommitdiff
path: root/AK/StringUtils.h
diff options
context:
space:
mode:
authordemostanis <demostanis@protonmail.com>2022-10-22 16:31:59 +0200
committerLinus Groh <mail@linusgroh.de>2022-10-24 23:29:18 +0100
commit7c33f8f7df321e2406f324f9aaa3890620a192e5 (patch)
treed3a7059d254b78456d0b3c1de81dc65542ec33bd /AK/StringUtils.h
parent3e8b5ac92012e19847e536a20a3f0ec7e5c787d3 (diff)
downloadserenity-7c33f8f7df321e2406f324f9aaa3890620a192e5.zip
AK: Add SplitBehavior::KeepTrailingSeparator with tests
Diffstat (limited to 'AK/StringUtils.h')
-rw-r--r--AK/StringUtils.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/AK/StringUtils.h b/AK/StringUtils.h
index 60dde9c359..883196ecfb 100644
--- a/AK/StringUtils.h
+++ b/AK/StringUtils.h
@@ -40,10 +40,17 @@ enum class TrimWhitespace {
};
enum class SplitBehavior : unsigned {
+ // Neither keep empty substrings nor keep the trailing separator.
+ // This is the default behavior if unspecified.
Nothing = 0,
+
// If two separators follow each other without any characters
- // in between, keep a "" in the resulting vector.
+ // in between, keep a "" in the resulting vector. (or only the
+ // separator if KeepTrailingSeparator is used)
KeepEmpty = 1,
+
+ // Do not strip off the separator at the end of the string.
+ KeepTrailingSeparator = 2,
};
AK_ENUM_BITWISE_OPERATORS(SplitBehavior);