diff options
| author | ilotterytea <iltsu@alright.party> | 2024-04-21 00:22:51 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-04-21 00:22:51 +0500 |
| commit | f894c2f8c1fec7248d141269a6c9047d8b80f68d (patch) | |
| tree | 731e9a02ab1c90c14e68c7e8bf166e93bb6664e1 /src/utils/string.cpp | |
| parent | 25ba548e015f3be7c2724617d9258858da7cc66a (diff) | |
feat: split text util
Diffstat (limited to 'src/utils/string.cpp')
| -rw-r--r-- | src/utils/string.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/string.cpp b/src/utils/string.cpp new file mode 100644 index 0000000..165067d --- /dev/null +++ b/src/utils/string.cpp @@ -0,0 +1,18 @@ +#include "string.hpp" + +#include <sstream> +#include <string> +#include <vector> + +std::vector<std::string> split_text(const std::string &text, char delimiter) { + std::vector<std::string> parts; + + std::istringstream iss(text); + std::string part; + + while (std::getline(iss, part, delimiter)) { + parts.push_back(part); + } + + return parts; +} |
