osuplusplus/include/string_util.hpp

21 lines
505 B
C++
Raw Normal View History

#pragma once
#ifndef PP_DEBUG
#include <algorithm>
#include <string>
#endif
inline void toLower(std::string &str) {
std::transform(str.begin(), str.end(), str.begin(),
[](unsigned char c){ return std::tolower(c); });
}
inline void toUpper(std::string &str) {
std::transform(str.begin(), str.end(), str.begin(),
[](unsigned char c){ return std::toupper(c); });
}
inline bool isInt(const std::string &str) {
return str.find_first_not_of("1234567890") == std::string::npos;
}