Trims whitespaces from the left end of the input utf8 sequence
| 323 | |
| 324 | // Trims whitespaces from the left end of the input utf8 sequence |
| 325 | FORCE_INLINE |
| 326 | const char* ltrim_utf8(gdv_int64 context, const char* data, gdv_int32 data_len, |
| 327 | int32_t* out_len) { |
| 328 | if (data_len == 0) { |
| 329 | *out_len = 0; |
| 330 | return ""; |
| 331 | } |
| 332 | |
| 333 | gdv_int32 start = 0; |
| 334 | // start denotes the first position of non-space characters in the input string |
| 335 | while (start < data_len && data[start] == ' ') { |
| 336 | ++start; |
| 337 | } |
| 338 | |
| 339 | *out_len = data_len - start; |
| 340 | return data + start; |
| 341 | } |
| 342 | |
| 343 | // Trims whitespaces from the right end of the input utf8 sequence |
| 344 | FORCE_INLINE |