Mercurial > minori
comparison src/core/strings.cc @ 231:69f4768a820c
chore: merge divergent branches
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sat, 13 Jan 2024 09:43:41 -0500 |
parents | 2f5a9247e501 f784b5b1914c |
children | c130f47f6f48 |
comparison
equal
deleted
inserted
replaced
230:2f5a9247e501 | 231:69f4768a820c |
---|---|
28 std::string out; | 28 std::string out; |
29 | 29 |
30 for (unsigned long long i = 0; i < vector.size(); i++) { | 30 for (unsigned long long i = 0; i < vector.size(); i++) { |
31 out.append(vector.at(i)); | 31 out.append(vector.at(i)); |
32 if (i < vector.size() - 1) | 32 if (i < vector.size() - 1) |
33 out.append(delimiter); | |
34 } | |
35 | |
36 return out; | |
37 } | |
38 | |
39 std::string Implode(const std::set<std::string>& set, const std::string& delimiter) { | |
40 if (set.size() < 1) | |
41 return "-"; | |
42 | |
43 std::string out; | |
44 | |
45 for (auto it = set.cbegin(); it != set.cend(); it++) { | |
46 out.append(*it); | |
47 if (it != std::prev(set.cend(), 1)) | |
33 out.append(delimiter); | 48 out.append(delimiter); |
34 } | 49 } |
35 | 50 |
36 return out; | 51 return out; |
37 } | 52 } |