common: utils to split / join / repeat strings (from json converter) (#11342)

* Factor string_join, string_split, string_repeat into common

* json: refactor to surface a versatile builder

* Update common.cpp
This commit is contained in:
Olivier Chafik 2025-01-22 09:51:44 +00:00 committed by GitHub
parent 3e3357fd77
commit a94f3b2727
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 90 additions and 64 deletions

View file

@ -429,6 +429,10 @@ std::string string_format(const char * fmt, ...);
std::string string_strip(const std::string & str);
std::string string_get_sortable_timestamp();
std::string string_join(const std::vector<std::string> & values, const std::string & separator);
std::vector<std::string> string_split(const std::string & str, const std::string & delimiter);
std::string string_repeat(const std::string & str, size_t n);
void string_replace_all(std::string & s, const std::string & search, const std::string & replace);
template<class T>