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.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index 0009f28882..e14c65d206 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -15,6 +15,7 @@
#include "AppHdr.h"
#include "defines.h"
+#include <cctype>
#include <string>
#include <vector>
@@ -67,6 +68,32 @@ std::vector<std::string> split_string(
bool trim = true,
bool accept_empties = false);
+inline std::string lowercase_first(std::string s)
+{
+ if (s.length())
+ s[0] = tolower(s[0]);
+ return (s);
+}
+
+template <class Z>
+std::string comma_separated_line(Z start, Z end)
+{
+ std::string text;
+ for (Z i = start; i != end; ++i)
+ {
+ if (i != start)
+ {
+ if (i + 1 != end)
+ text += ", ";
+ else
+ text += " and ";
+ }
+
+ text += i->name;
+ }
+ return (text);
+}
+
#ifdef NEED_USLEEP
void usleep( unsigned long time );
#endif