2022-03-03 07:49:58 +00:00
|
|
|
#include "functions.hpp"
|
2020-09-16 09:20:27 +00:00
|
|
|
|
|
|
|
std::string LunchRest::nodeToText(xmlpp::Node *node) {
|
|
|
|
return dynamic_cast<const xmlpp::ContentNode *>(node)->get_content();
|
|
|
|
}
|
2021-02-09 22:23:37 +00:00
|
|
|
|
|
|
|
std::string LunchRest::trim(const std::string &input) {
|
|
|
|
const std::string whitespace = "\t\n\v\f\r ";
|
|
|
|
std::string ret = input;
|
|
|
|
ret.erase(0, ret.find_first_not_of(whitespace));
|
|
|
|
ret.erase(ret.find_last_not_of(whitespace) + 1);
|
|
|
|
for(size_t i = 0; i < ret.length(); i++) {
|
|
|
|
if(ret[i] == '\n')
|
|
|
|
ret[i] = ' ';
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|