From 331d7042f2733dc04df672516b213259e25f71ef Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Sun, 10 Jul 2016 04:25:12 +0000 Subject: [PATCH] Added Util::ToLower() --- Src/Util/Format.cpp | 8 ++++++++ Src/Util/Format.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/Src/Util/Format.cpp b/Src/Util/Format.cpp index f7114d8..d2566a9 100644 --- a/Src/Util/Format.cpp +++ b/Src/Util/Format.cpp @@ -1,8 +1,16 @@ #include "Util/Format.h" +#include #include namespace Util { + std::string ToLower(const std::string &str) + { + std::string tmp(str); + std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower); + return tmp; + } + std::string TrimWhiteSpace(const std::string &str) { if (str.empty()) diff --git a/Src/Util/Format.h b/Src/Util/Format.h index f10d02d..7a680f6 100644 --- a/Src/Util/Format.h +++ b/Src/Util/Format.h @@ -76,6 +76,8 @@ namespace Util { } private: + //TODO: write own buffer implementation to more easily support ToLower() et + // al as methods of Util::Format std::stringstream m_stream; void clear() @@ -84,6 +86,7 @@ namespace Util } }; + std::string ToLower(const std::string &str); std::string TrimWhiteSpace(const std::string &str); std::string Hex(uint32_t n, size_t num_digits); std::string Hex(uint32_t n);