2017-11-23 16:50:16 -08:00
|
|
|
#ifndef EOLIAN_MONO_UTILS_HPP
|
|
|
|
#define EOLIAN_MONO_UTILS_HPP
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2018-03-19 16:35:36 -07:00
|
|
|
/* Compared to the helpers.hh header, these functions are lower level, not dealing with
|
|
|
|
* binding-specific structures or knowledge */
|
|
|
|
|
2017-11-23 16:50:16 -08:00
|
|
|
namespace eolian_mono { namespace utils {
|
|
|
|
|
|
|
|
// Helper method to avoid multiple as_generator calls when mixing case strings
|
2018-03-19 16:35:36 -07:00
|
|
|
inline std::string to_uppercase(std::string s)
|
2017-11-23 16:50:16 -08:00
|
|
|
{
|
|
|
|
std::transform(s.begin(), s.end(), s.begin(), ::toupper);
|
|
|
|
return s;
|
|
|
|
}
|
2018-03-19 16:35:36 -07:00
|
|
|
inline std::string to_lowercase(std::string s)
|
2017-11-23 16:50:16 -08:00
|
|
|
{
|
|
|
|
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
|
|
|
|
return s;
|
|
|
|
}
|
2018-03-19 16:35:36 -07:00
|
|
|
inline std::string capitalize(std::string const &s)
|
|
|
|
{
|
|
|
|
std::string ret = s;
|
|
|
|
ret[0] = std::toupper(ret[0]);
|
|
|
|
return ret;
|
|
|
|
}
|
2017-11-23 16:50:16 -08:00
|
|
|
} }
|
|
|
|
|
|
|
|
#endif
|