From df9a03f4161ae8bc3a3ea6cd58fcfd539afb1502 Mon Sep 17 00:00:00 2001 From: Rogier Date: Mon, 21 Dec 2015 20:33:08 +0100 Subject: [PATCH] Create strlower() function to convert std::string to lowercase. --- util.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 util.h diff --git a/util.h b/util.h new file mode 100644 index 0000000..efaa167 --- /dev/null +++ b/util.h @@ -0,0 +1,16 @@ + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include + +inline std::string strlower(const std::string &s) +{ + int l = s.length(); + std::string sl = s; + for (int i = 0; i < l; i++) + sl[i] = tolower(sl[i]); + return sl; +} + +#endif // _UTIL_H_