trim white spaces from right end of an input string
| 732 | |
| 733 | // trim white spaces from right end of an input string |
| 734 | static std::string trim_right(const std::string &input_string) { |
| 735 | std::string result = input_string; |
| 736 | result.erase( |
| 737 | std::find_if(result.rbegin(), result.rend(), [](int ch) { return !std::isspace(ch); }) |
| 738 | .base(), |
| 739 | result.end()); |
| 740 | return result; |
| 741 | } |
| 742 | |
| 743 | // trim white spaces from either end of an input string |
| 744 | static std::string trim(const std::string &input_string) { |