diff src/core/strings.cc @ 226:f784b5b1914c

settings: add library page
author Paper <mrpapersonic@gmail.com>
date Mon, 08 Jan 2024 21:23:00 -0500
parents 53211cb1e7f5
children 69f4768a820c
line wrap: on
line diff
--- a/src/core/strings.cc	Mon Jan 08 17:07:01 2024 -0500
+++ b/src/core/strings.cc	Mon Jan 08 21:23:00 2024 -0500
@@ -35,6 +35,21 @@
 	return out;
 }
 
+std::string Implode(const std::set<std::string>& set, const std::string& delimiter) {
+	if (set.size() < 1)
+		return "-";
+
+	std::string out;
+
+	for (auto it = set.cbegin(); it != set.cend(); it++) {
+		out.append(*it);
+		if (it != std::prev(set.cend(), 1))
+			out.append(delimiter);
+	}
+
+	return out;
+}
+
 std::vector<std::string> Split(const std::string &text, const std::string& delimiter) {
 	std::vector<std::string> tokens;