hikyuu2/hikyuu_cpp/hikyuu/utilities/arithmetic.h
2019-11-10 19:45:57 +08:00

42 lines
793 B
C++

/*
* arithmetic.h
*
* Copyright (c) 2019 hikyuu.org
*
* Created on: 2019-7-15
* Author: fasiondog
*/
#pragma once
#ifndef HIKYUU_UTILITIES_ARITHMETIC_H
#define HIKYUU_UTILITIES_ARITHMETIC_H
#include <cctype>
#include <string>
#include <algorithm>
namespace hku {
/**
* @ingroup Utilities
* @{
*/
/** 转小写字符串 */
void to_lower(std::string& s);
/** 转大写字符串 */
void to_upper(std::string& s);
inline void to_lower(std::string& s) {
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::tolower(c); });
}
inline void to_upper(std::string& s) {
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::toupper(c); });
}
/** @} */
} /* namespace hku */
#endif /* HIKYUU_UTILITIES_ARITHMETIC_H */