stuff-from-scratch/src/core/StringUtils.cpp
2021-03-29 21:31:24 +01:00

23 lines
467 B
C++

#include "StringUtils.h"
#include <locale>
#include <algorithm>
bool StringUtils::IsAlphaNumeric(char c)
{
std::locale loc;
return std::isalnum(c, loc);
}
bool StringUtils::IsSpace(char c)
{
std::locale loc;
return std::isspace(c, loc);
}
std::string StringUtils::ToLower(const std::string& s)
{
std::string ret;
std::transform(s.begin(), s.end(), ret.begin(),
[](unsigned char c){ return std::tolower(c); });
return ret;
}