feat add ToUpper,ToLower
This commit is contained in:
parent
fcce11249b
commit
4402688c9c
@ -6,6 +6,8 @@
|
||||
|
||||
namespace sled {
|
||||
|
||||
char ToLower(char c);
|
||||
char ToUpper(char c);
|
||||
std::string ToLower(const std::string &str);
|
||||
std::string ToUpper(const std::string &str);
|
||||
std::string ToHex(const std::string &str);
|
||||
|
@ -1,8 +1,39 @@
|
||||
#include "sled/strings/utils.h"
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
|
||||
namespace sled {
|
||||
|
||||
char
|
||||
ToLower(char c)
|
||||
{
|
||||
return ::tolower(c);
|
||||
}
|
||||
|
||||
char
|
||||
ToUpper(char c)
|
||||
{
|
||||
return ::toupper(c);
|
||||
}
|
||||
|
||||
std::string
|
||||
ToLower(const std::string &str)
|
||||
{
|
||||
std::string result;
|
||||
std::transform(str.begin(), str.end(), std::back_inserter(result),
|
||||
::tolower);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string
|
||||
ToUpper(const std::string &str)
|
||||
{
|
||||
std::string result;
|
||||
std::transform(str.begin(), str.end(), std::back_inserter(result),
|
||||
::toupper);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string
|
||||
StrJoin(const std::vector<std::string> &strings,
|
||||
const std::string &delim,
|
||||
|
Loading…
Reference in New Issue
Block a user