aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/string.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-01-13 15:00:28 +0100
committerGitHub Enterprise <[email protected]>2026-01-13 15:00:28 +0100
commit0e20ec796d79650e9e9ebf5c2561b1633b4b2020 (patch)
tree89d1f9d7fd95dca63fd15cae26a0b12d45c10944 /src/zencore/string.cpp
parentfixed block generation after bug introduced in PR #704 (#707) (diff)
downloadzen-0e20ec796d79650e9e9ebf5c2561b1633b4b2020.tar.xz
zen-0e20ec796d79650e9e9ebf5c2561b1633b4b2020.zip
added options to configure exclude folders and extensions to zen build commands (#706)
* added `--exclude-folders` to `zen upload`, `zen download` and `zen diff` added `--exclude-extensions` to `zen upload` and `zen diff` excluded folder names are now matched by folder name in subfolders in addition to root level folders * allow multiple token separators
Diffstat (limited to 'src/zencore/string.cpp')
-rw-r--r--src/zencore/string.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/zencore/string.cpp b/src/zencore/string.cpp
index c8c7c2cde..0ee863b74 100644
--- a/src/zencore/string.cpp
+++ b/src/zencore/string.cpp
@@ -1067,6 +1067,42 @@ TEST_CASE("string")
TokenCount = ForEachStrTok(""sv, ',', [](const std::string_view&) { return true; });
CHECK(TokenCount == ExpectedTokenCount);
}
+
+ SUBCASE("ForEachStrTok2")
+ {
+ const auto Tokens = "here,is;my,different tokens"sv;
+ const auto ExpectedTokens = "here,is,my,different,tokens"sv;
+ int32_t ExpectedTokenCount = 5;
+ int32_t TokenCount = 0;
+ StringBuilder<512> Sb;
+
+ TokenCount = ForEachStrTok(Tokens, " ,;", [&Sb](const std::string_view& Token) {
+ if (Sb.Size())
+ {
+ Sb << ",";
+ }
+ Sb << Token;
+ return true;
+ });
+
+ CHECK(TokenCount == ExpectedTokenCount);
+ CHECK(Sb.ToString() == ExpectedTokens);
+
+ ExpectedTokenCount = 1;
+ const auto Str = "mosdef"sv;
+
+ Sb.Reset();
+ TokenCount = ForEachStrTok(Str, " ,;", [&Sb](const std::string_view& Token) {
+ Sb << Token;
+ return true;
+ });
+ CHECK(Sb.ToString() == Str);
+ CHECK(TokenCount == ExpectedTokenCount);
+
+ ExpectedTokenCount = 0;
+ TokenCount = ForEachStrTok(""sv, " ,;", [](const std::string_view&) { return true; });
+ CHECK(TokenCount == ExpectedTokenCount);
+ }
}
#endif