diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-05 18:12:43 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-05 18:12:43 +0500 |
| commit | e39d90442dfd6fb136cda23b0d013da98fb089e9 (patch) | |
| tree | 56d31185d7f64536b1ba5047ceeb6791667d97c2 /bot/src/utils/string.cpp | |
| parent | 11ca4bf50b7b14b8be54756cb2a7f37ef31890a8 (diff) | |
feat: parse irc messages fully
Diffstat (limited to 'bot/src/utils/string.cpp')
| -rw-r--r-- | bot/src/utils/string.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bot/src/utils/string.cpp b/bot/src/utils/string.cpp index 38087dc..0dd79dd 100644 --- a/bot/src/utils/string.cpp +++ b/bot/src/utils/string.cpp @@ -113,6 +113,20 @@ namespace bot { return lines; } + + std::vector<std::string> split_text_n(std::string value, + const std::string &separator, + const int &n) { + std::vector<std::string> v; + int fi, i = 0; + while ((fi = value.find(separator)) != std::string::npos && i < n) { + v.push_back(value.substr(0, fi)); + value = value.substr(fi + separator.size()); + i++; + } + v.push_back(value); + return v; + } } } } |
