Added Util::ToLower()

This commit is contained in:
Bart Trzynadlowski 2016-07-10 04:25:12 +00:00
parent a84aacf80b
commit 331d7042f2
2 changed files with 11 additions and 0 deletions

View file

@ -1,8 +1,16 @@
#include "Util/Format.h"
#include <algorithm>
#include <cctype>
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())

View file

@ -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);