1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:27:35 +00:00

AK: Add SplitBehavior::KeepTrailingSeparator with tests

This commit is contained in:
demostanis 2022-10-22 16:31:59 +02:00 committed by Linus Groh
parent 3e8b5ac920
commit 7c33f8f7df
5 changed files with 26 additions and 6 deletions

View file

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