diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-01-20 12:18:35 +0100 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-01-20 12:18:35 +0100 |
| commit | 81ccfac99e87c1c032f632f4caf14d0ca44eaf23 (patch) | |
| tree | ff57b1ac4a153ef3a2c7d3a4ba1e45c621d8d4cf /libbridge/src/main/cpp/helpers.cpp | |
| parent | f03ad3177a50c52dcf93a8d4ba58718b3562bd7a (diff) | |
| parent | 6c5d7aa67af4a9493229cee2ea3c26cd3c2eafd3 (diff) | |
Merge pull request 'Configure Renovate' (#3) from renovate/configure into anonero
Reviewed-on: https://git.mrcyjanek.net/mrcyjanek/monero_c/pulls/3
Diffstat (limited to 'libbridge/src/main/cpp/helpers.cpp')
| -rw-r--r-- | libbridge/src/main/cpp/helpers.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libbridge/src/main/cpp/helpers.cpp b/libbridge/src/main/cpp/helpers.cpp index 064ce36..04befc6 100644 --- a/libbridge/src/main/cpp/helpers.cpp +++ b/libbridge/src/main/cpp/helpers.cpp @@ -143,3 +143,18 @@ const char* vectorToString(const std::set<uint32_t>& intSet, const std::string s memcpy(buffer, str.c_str(), size + 1); return buffer; } + +std::set<std::string> splitString(const std::string& str, const std::string& delim) { + std::set<std::string> tokens; + if (str.empty()) return tokens; + size_t pos = 0; + std::string token; + std::string content = str; // Copy of str so we can safely erase content + while ((pos = content.find(delim)) != std::string::npos) { + token = content.substr(0, pos); + tokens.insert(token); + content.erase(0, pos + delim.length()); + } + tokens.insert(content); // Inserting the last token + return tokens; +}
\ No newline at end of file |
