Fix join, we dont have a StringView from char array constructor

This commit is contained in:
Maxime Coste 2016-12-17 06:06:07 +00:00
parent 2bdd361948
commit cf10f3f0a0

View File

@ -330,13 +330,13 @@ String replace(StringView str, StringView substr, StringView replacement);
template<typename Container>
String join(const Container& container, char joiner, bool esc_joiner = true)
{
const char to_escape[] = { joiner, '\\' };
const char to_escape[2] = { joiner, '\\' };
String res;
for (const auto& str : container)
{
if (not res.empty())
res += joiner;
res += esc_joiner ? escape(str, to_escape, '\\') : str;
res += esc_joiner ? escape(str, {to_escape, 2}, '\\') : str;
}
return res;
}