| 34 | } |
| 35 | |
| 36 | std::string trim(std::string&& str, |
| 37 | const std::string& whitespace = " \t\n") |
| 38 | { |
| 39 | const auto strEnd = str.find_last_not_of(whitespace); |
| 40 | if (strEnd==std::string::npos) |
| 41 | return {}; // no content |
| 42 | str.erase(strEnd+1); |
| 43 | |
| 44 | const auto strBegin = str.find_first_not_of(whitespace); |
| 45 | str.erase(0, strBegin); |
| 46 | |
| 47 | return std::move(str); |
| 48 | } |
| 49 | |
| 50 | std::vector<std::string> split(std::string const& str, size_t pos = 0) |
| 51 | { |