diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-01-02 22:42:31 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-01-02 22:42:31 +0100 |
| commit | 6ed8f5151719fbc14ec0ac6d28a346d1f74cf2ca (patch) | |
| tree | ebe7588e89e1aa2ae5376acf85f3a3a7b2ec7e10 /src/str.hh | |
Diffstat (limited to 'src/str.hh')
| -rw-r--r-- | src/str.hh | 34 |
1 files changed, 34 insertions, 0 deletions
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 <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); + +void split(std::string_view str, std::vector<std::string_view>& out, + std::string_view separator, bool keep_empty = false); + +[[nodiscard]] std::vector<std::string_view> 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 |
