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