diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-14T12·42+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-14T12·58+0200 |
commit | a75d11a7e6984b3df15da9677fbd49ee8de7a9c3 (patch) | |
tree | 8dc4d2f167360def381dca93371e39ed40776bba /src/libutil/util.cc | |
parent | e07c0dcf5c128875bf8af740b2c4bc81918713c9 (diff) |
Add a toLower utility function
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 7efaf3e89e6a..87e97c20fa3d 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -9,6 +9,7 @@ #include <cstdlib> #include <sstream> #include <cstring> +#include <cctype> #include <sys/wait.h> #include <unistd.h> @@ -1087,6 +1088,15 @@ bool hasSuffix(const string & s, const string & suffix) } +std::string toLower(const std::string & s) +{ + std::string r(s); + for (auto & c : r) + c = std::tolower(c); + return r; +} + + string decodeOctalEscaped(const string & s) { string r; |