| 985 | } |
| 986 | |
| 987 | std::pair<size_t, size_t> TrimImpl(absl::string_view string) { |
| 988 | absl::string_view temp_string = string; |
| 989 | size_t left_trim_bytes = 0; |
| 990 | while (!temp_string.empty()) { |
| 991 | char32_t c; |
| 992 | size_t char_len = cel::internal::Utf8Decode(temp_string, &c); |
| 993 | if (!IsUnicodeWhitespace(c)) { |
| 994 | break; |
| 995 | } |
| 996 | temp_string.remove_prefix(char_len); |
| 997 | left_trim_bytes += char_len; |
| 998 | } |
| 999 | |
| 1000 | if (left_trim_bytes == string.size()) { |
| 1001 | return {left_trim_bytes, 0}; |
| 1002 | } |
| 1003 | |
| 1004 | size_t last_non_ws_end_bytes = 0; |
| 1005 | size_t current_pos_bytes = 0; |
| 1006 | temp_string = string; |
| 1007 | while (!temp_string.empty()) { |
| 1008 | char32_t c; |
| 1009 | size_t char_len = cel::internal::Utf8Decode(temp_string, &c); |
| 1010 | if (!IsUnicodeWhitespace(c)) { |
| 1011 | last_non_ws_end_bytes = current_pos_bytes + char_len; |
| 1012 | } |
| 1013 | current_pos_bytes += char_len; |
| 1014 | temp_string.remove_prefix(char_len); |
| 1015 | } |
| 1016 | |
| 1017 | return {left_trim_bytes, string.size() - last_non_ws_end_bytes}; |
| 1018 | } |
| 1019 | |
| 1020 | absl::Cord TrimImpl(const absl::Cord& cord) { |
| 1021 | size_t left_trim_bytes = 0; |
nothing calls this directly
no test coverage detected