summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-12 13:49:05 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-12 13:49:05 +0000
commit5e94dac9e3537693dfaa1647c143959d1ce5e069 (patch)
tree028910f8f34f595a7ef4802e0d0e5d57f5e6b65c /crawl-ref/source/libutil.h
parente5241a144e28fd3aaa803a592eb4656eddc53a27 (diff)
downloadcrawl-ref-5e94dac9e3537693dfaa1647c143959d1ce5e069.tar.gz
crawl-ref-5e94dac9e3537693dfaa1647c143959d1ce5e069.zip
Better explore-stop messages.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@619 c06c8d41-db1a-0410-9941-cceddc491573
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