diff --git a/lang/cpp/src/util.h b/lang/cpp/src/util.h index b6f9ca50..423973a8 100644 --- a/lang/cpp/src/util.h +++ b/lang/cpp/src/util.h @@ -177,6 +177,19 @@ static inline gpgme_sig_notation_flags_t add_to_gpgme_sig_notation_flags_t(unsi return static_cast(result); } +static inline std::vector split(const std::string &text, char delimiter) +{ + std::vector result; + if (!text.empty()) { + std::istringstream stream{text}; + std::string line; + while (std::getline(stream, line, delimiter)) { + result.push_back(line); + } + } + return result; +} + /** * Adapter for passing a vector of strings as NULL-terminated array of * const char* to the C-interface of gpgme.