From 6ed8f5151719fbc14ec0ac6d28a346d1f74cf2ca Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Fri, 2 Jan 2026 22:42:31 +0100 Subject: Initial commit --- src/str.hh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/str.hh (limited to 'src/str.hh') diff --git a/src/str.hh b/src/str.hh new file mode 100644 index 0000000..c736f4b --- /dev/null +++ b/src/str.hh @@ -0,0 +1,34 @@ +#ifndef STR_HH +#define STR_HH + +#include +#include + +namespace str { + +void split(std::string_view str, std::vector& out, + char separator = ' ', bool keep_empty = false); + +[[nodiscard]] std::vector split(std::string_view str, + char separator = ' ', + bool keep_empty = false); + +void split(std::string_view str, std::vector& out, + std::string_view separator, bool keep_empty = false); + +[[nodiscard]] std::vector split(std::string_view str, + std::string_view separator, + bool keep_empty = false); + +[[nodiscard]] +std::string_view trim(std::string_view str); + +[[nodiscard]] +std::string_view ltrim(std::string_view str); + +[[nodiscard]] +std::string_view rtrim(std::string_view str); + +} // namespace str + +#endif // STR_HH -- cgit v1.2.3-70-g09d2