MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / tokenize_string

Function tokenize_string

nanofi/src/core/string_utils.c:126–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126token_list tokenize_string(const char * begin, char delim) {
127 token_list tks;
128 memset(&tks, 0, sizeof(struct token_list));
129
130 if (!begin) return tks;
131
132 const char * end = NULL;
133
134 while ((end = strchr(begin, delim))) {
135 if (begin == end) {
136 begin++;
137 tks.total_bytes++;
138 continue;
139 }
140 size_t len = end - begin;
141 add_token_to_list(&tks, begin, len);
142 tks.total_bytes++;
143 begin = (end+1);
144 }
145
146 if (begin && *begin != '\0') {
147 size_t len = strlen(begin);
148 if (len < MAX_BYTES_READ) {
149 tks.has_non_delimited_token = 1;
150 }
151 add_token_to_list(&tks, begin, len);
152 }
153
154 return tks;
155}
156
157token_list tokenize_string_tailfile(const char * str, char delim) {
158 token_list tks = tokenize_string(str, delim);

Callers 2

tokenize_string_tailfileFunction · 0.85

Calls 1

add_token_to_listFunction · 0.85

Tested by

no test coverage detected