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

Function TrimWhiteSpace

cpp/src/arrow/csv/converter.cc:68–86  ·  view source on GitHub ↗

Updates data_inout and size_inout to not include leading/trailing whitespace characters.

Source from the content-addressed store, hash-verified

66// Updates data_inout and size_inout to not include leading/trailing whitespace
67// characters.
68inline void TrimWhiteSpace(const uint8_t** data_inout, uint32_t* size_inout) {
69 const uint8_t*& data = *data_inout;
70 uint32_t& size = *size_inout;
71 // Skip trailing whitespace
72 if (ARROW_PREDICT_TRUE(size > 0) && ARROW_PREDICT_FALSE(IsWhitespace(data[size - 1]))) {
73 const uint8_t* p = data + size - 1;
74 while (size > 0 && IsWhitespace(*p)) {
75 --size;
76 --p;
77 }
78 }
79 // Skip leading whitespace
80 if (ARROW_PREDICT_TRUE(size > 0) && ARROW_PREDICT_FALSE(IsWhitespace(data[0]))) {
81 while (size > 0 && IsWhitespace(*data)) {
82 --size;
83 ++data;
84 }
85 }
86}
87
88Status InitializeTrie(const std::vector<std::string>& inputs, Trie* trie) {
89 TrieBuilder builder;

Callers 3

DecodeMethod · 0.85
DecodeMethod · 0.85
DecodeMethod · 0.85

Calls 1

IsWhitespaceFunction · 0.70

Tested by

no test coverage detected