|
|
@ -174,13 +174,13 @@ static inline void set_to_limit(int &value, const int maximum, const int min = 0
|
|
|
|
|
|
|
|
|
|
|
|
// trim from start
|
|
|
|
// trim from start
|
|
|
|
static inline std::string <rim(std::string &s) {
|
|
|
|
static inline std::string <rim(std::string &s) {
|
|
|
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
|
|
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char x){ return !std::isspace(x); }));
|
|
|
|
return s;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// trim from end
|
|
|
|
// trim from end
|
|
|
|
static inline std::string &rtrim(std::string &s) {
|
|
|
|
static inline std::string &rtrim(std::string &s) {
|
|
|
|
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
|
|
|
|
s.erase(std::find_if(s.rbegin(), s.rend(), [](char x){ return !std::isspace(x); }).base(), s.end());
|
|
|
|
return s;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|