| 193 | } |
| 194 | |
| 195 | static std::string internalUTF8MoveRight(std::string_view utf8Text, int length /* default utf8Text.length() */) |
| 196 | { |
| 197 | if (!utf8Text.empty() && length >= 0) |
| 198 | { |
| 199 | |
| 200 | // get the delete byte number |
| 201 | size_t addLen = 1; // default, erase 1 byte |
| 202 | |
| 203 | while ((length + addLen) < utf8Text.size() && 0x80 == (0xC0 & utf8Text.at(length + addLen))) |
| 204 | { |
| 205 | ++addLen; |
| 206 | } |
| 207 | |
| 208 | return std::string{utf8Text.data(), static_cast<size_t>(length + addLen)}; |
| 209 | } |
| 210 | else |
| 211 | { |
| 212 | return std::string{utf8Text}; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | ////////////////////////////////////////////////////////////////////////// |
| 217 | // constructor and destructor |
no test coverage detected