summaryrefslogtreecommitdiff
path: root/src/string_utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-04-29 23:05:46 +1000
committerMaxime Coste <mawww@kakoune.org>2018-04-29 23:06:24 +1000
commite4f90e5ed2645895576af4f13a6213e95d1bf605 (patch)
tree24b4d02bcd40dd846cef8d2c67b54a8d7030bcf6 /src/string_utils.hh
parentbcecb2f8772fa28aeafc476b98fbdcb09521f73e (diff)
Fix tests after changes to json_ui output
Diffstat (limited to 'src/string_utils.hh')
-rw-r--r--src/string_utils.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/string_utils.hh b/src/string_utils.hh
index 1db9da24..db532f0d 100644
--- a/src/string_utils.hh
+++ b/src/string_utils.hh
@@ -38,6 +38,19 @@ String join(const Container& container, char joiner, bool esc_joiner = true)
return res;
}
+template<typename Container>
+String join(const Container& container, StringView joiner)
+{
+ String res;
+ for (const auto& str : container)
+ {
+ if (not res.empty())
+ res += joiner;
+ res += str;
+ }
+ return res;
+}
+
inline bool prefix_match(StringView str, StringView prefix)
{
return str.substr(0_byte, prefix.length()) == prefix;