trim whitespace from the beginning and end of a string
| 12 | |
| 13 | // trim whitespace from the beginning and end of a string |
| 14 | static std::string trim(const std::string & str) { |
| 15 | size_t start = 0; |
| 16 | size_t end = str.size(); |
| 17 | |
| 18 | while (start < end && isspace(str[start])) { |
| 19 | start += 1; |
| 20 | } |
| 21 | |
| 22 | while (end > start && isspace(str[end - 1])) { |
| 23 | end -= 1; |
| 24 | } |
| 25 | |
| 26 | return str.substr(start, end - start); |
| 27 | } |
| 28 | |
| 29 | static std::string k_system = |
| 30 | R"(Transcript of a never ending dialog, where the User interacts with an Assistant. |