diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index 139fe3017a..fc627b230b 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -56,6 +56,19 @@ public: bool is_empty() const { return m_length == 0; } void trim(size_t count) { m_length -= count; } + template + void join(const SeparatorType& separator, const CollectionType& collection) + { + bool first = true; + for (auto& item : collection) { + if (first) + first = false; + else + append(separator); + append(item); + } + } + private: void will_append(size_t);