Fix join, we dont have a StringView from char array constructor
This commit is contained in:
parent
2bdd361948
commit
cf10f3f0a0
|
@ -330,13 +330,13 @@ String replace(StringView str, StringView substr, StringView replacement);
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
String join(const Container& container, char joiner, bool esc_joiner = true)
|
String join(const Container& container, char joiner, bool esc_joiner = true)
|
||||||
{
|
{
|
||||||
const char to_escape[] = { joiner, '\\' };
|
const char to_escape[2] = { joiner, '\\' };
|
||||||
String res;
|
String res;
|
||||||
for (const auto& str : container)
|
for (const auto& str : container)
|
||||||
{
|
{
|
||||||
if (not res.empty())
|
if (not res.empty())
|
||||||
res += joiner;
|
res += joiner;
|
||||||
res += esc_joiner ? escape(str, to_escape, '\\') : str;
|
res += esc_joiner ? escape(str, {to_escape, 2}, '\\') : str;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user