MCPcopy Create free account
hub / github.com/apache/arrow / rtrim_utf8

Function rtrim_utf8

cpp/src/gandiva/precompiled/string_ops.cc:344–360  ·  view source on GitHub ↗

Trims whitespaces from the right end of the input utf8 sequence

Source from the content-addressed store, hash-verified

342
343// Trims whitespaces from the right end of the input utf8 sequence
344FORCE_INLINE
345const char* rtrim_utf8(gdv_int64 context, const char* data, gdv_int32 data_len,
346 int32_t* out_len) {
347 if (data_len == 0) {
348 *out_len = 0;
349 return "";
350 }
351
352 gdv_int32 end = data_len - 1;
353 // end denotes the last position of non-space characters in the input string
354 while (end >= 0 && data[end] == ' ') {
355 --end;
356 }
357
358 *out_len = end + 1;
359 return data;
360}
361
362// Trims whitespaces from both the ends of the input utf8 sequence
363FORCE_INLINE

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68