Helper function to remove the last UTF-8 character from a string
| 430 | |
| 431 | // Helper function to remove the last UTF-8 character from a string |
| 432 | static size_t prev_utf8_char_pos(const std::string & line, size_t pos) { |
| 433 | if (pos == 0) return 0; |
| 434 | pos--; |
| 435 | while (pos > 0 && (line[pos] & 0xC0) == 0x80) { |
| 436 | pos--; |
| 437 | } |
| 438 | return pos; |
| 439 | } |
| 440 | |
| 441 | static size_t next_utf8_char_pos(const std::string & line, size_t pos) { |
| 442 | if (pos >= line.length()) return line.length(); |
no outgoing calls
no test coverage detected