| 72 | } |
| 73 | |
| 74 | [[nodiscard]] TStringBuf Trim(TStringBuf str Y_LIFETIME_BOUND, TStringBuf whitespaces) |
| 75 | { |
| 76 | if (whitespaces.empty()) { |
| 77 | return str; |
| 78 | } |
| 79 | auto end = str.find_last_not_of(whitespaces); |
| 80 | |
| 81 | if (end == TStringBuf::npos) { |
| 82 | return ""; |
| 83 | } |
| 84 | |
| 85 | auto begin = str.find_first_not_of(whitespaces); |
| 86 | YT_VERIFY(begin != TStringBuf::npos); |
| 87 | return str.substr(begin, end - begin + 1); |
| 88 | } |
| 89 | |
| 90 | //////////////////////////////////////////////////////////////////////////////// |
| 91 |
no test coverage detected