summaryrefslogtreecommitdiff
path: root/src/string.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.hh')
-rw-r--r--src/string.hh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/string.hh b/src/string.hh
index 6fd2f5fb..00a20adc 100644
--- a/src/string.hh
+++ b/src/string.hh
@@ -330,12 +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, '\\' };
String res;
for (const auto& str : container)
{
if (not res.empty())
res += joiner;
- res += esc_joiner ? escape(str, joiner, '\\') : str;
+ res += esc_joiner ? escape(str, to_escape, '\\') : str;
}
return res;
}