diff options
author | Ben Deutsch <ben@bendeutsch.de> | 2018-08-05 13:13:38 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-08-05 13:13:38 +0200 |
commit | 153fb211ac2342907eb766a79c1f41824f981ab5 (patch) | |
tree | 58a927bbf9a7d3d3811df6a703de02362b6474fb /src/util/string.h | |
parent | 18368824958139f1428d534082852d778982b4c9 (diff) | |
download | minetest-153fb211ac2342907eb766a79c1f41824f981ab5.tar.gz minetest-153fb211ac2342907eb766a79c1f41824f981ab5.tar.bz2 minetest-153fb211ac2342907eb766a79c1f41824f981ab5.zip |
Replace auth.txt with SQLite auth database (#7279)
* Replace auth.txt with SQLite auth database
Diffstat (limited to 'src/util/string.h')
-rw-r--r-- | src/util/string.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util/string.h b/src/util/string.h index 35b7cfa8a..ab9a4a6c8 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -704,3 +704,22 @@ inline const std::string duration_to_string(int sec) return ss.str(); } + +/** + * Joins a vector of strings by the string \p delimiter. + * + * @return A std::string + */ +inline std::string str_join(const std::vector<std::string> &list, + const std::string &delimiter) +{ + std::ostringstream oss; + bool first = true; + for (const auto &part : list) { + if (!first) + oss << delimiter; + oss << part; + first = false; + } + return oss.str(); +} |