summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/libutil.h')
-rw-r--r--crawl-ref/source/libutil.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index be30ec5ebd..5ad02e504e 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -80,8 +80,10 @@ inline std::string lowercase_first(std::string s)
return (s);
}
-template <class Z>
-std::string comma_separated_line(Z start, Z end)
+template <typename Z>
+std::string comma_separated_line(Z start, Z end,
+ const std::string &andc = " and ",
+ const std::string &comma = ", ")
{
std::string text;
for (Z i = start; i != end; ++i)
@@ -89,9 +91,9 @@ std::string comma_separated_line(Z start, Z end)
if (i != start)
{
if (i + 1 != end)
- text += ", ";
+ text += comma;
else
- text += " and ";
+ text += andc;
}
text += *i;