summaryrefslogtreecommitdiff
path: root/src/str.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-10-07 09:12:22 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-10-07 09:13:15 +0200
commitc87f9627efc8b612eb9b000acfcc6731cad15765 (patch)
tree34eb4b9e70a51c2f3db3a97c2aef31ba0b139ec9 /src/str.hh
Initial commit
Diffstat (limited to 'src/str.hh')
-rw-r--r--src/str.hh21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/str.hh b/src/str.hh
new file mode 100644
index 0000000..e1ee549
--- /dev/null
+++ b/src/str.hh
@@ -0,0 +1,21 @@
+#ifndef STR_HH
+#define STR_HH
+
+#include <string_view>
+#include <vector>
+
+namespace str {
+
+void split(std::string_view str, std::vector<std::string_view>& out,
+ char separator = ' ', bool keep_empty = false);
+
+[[nodiscard]] std::vector<std::string_view> split(std::string_view str,
+ char separator = ' ',
+ bool keep_empty = false);
+
+[[nodiscard]]
+std::string_view trim(std::string_view str);
+
+} // namespace str
+
+#endif // STR_HH