diff --git a/include/string_util.hpp b/include/string_util.hpp new file mode 100644 index 0000000..7280251 --- /dev/null +++ b/include/string_util.hpp @@ -0,0 +1,20 @@ +#pragma once + +#ifndef PP_DEBUG +#include +#include +#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; +} diff --git a/src/osuparser.cpp b/src/osuparser.cpp index cd82a89..235eb44 100644 --- a/src/osuparser.cpp +++ b/src/osuparser.cpp @@ -1,5 +1,7 @@ #include +#include + #ifndef PP_DEBUG #include #include @@ -23,11 +25,6 @@ inline std::string checkAndRemove(const std::string &str, const std::string &pre return trimString(str.substr(prefix.length())); } -inline void toLower(std::string &str) { - std::transform(str.begin(), str.end(), str.begin(), - [](unsigned char c){ return std::tolower(c); }); -} - #define CONFIG(name, ...) \ name parse##name(fs::path configPath) {\ if (!fs::exists(configPath)) {\