MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / split_string_ptr

Function split_string_ptr

paddle/utils/string/string_helper.h:305–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303 return ar;
304}
305inline int split_string_ptr(const char* str,
306 size_t len,
307 char delim,
308 std::vector<str_ptr>* values) {
309 if (len <= 0) {
310 return 0;
311 }
312
313 int num = 0;
314 const char* p = str;
315 const char* end = str + len;
316 const char* last = str;
317 while (p < end) {
318 if (*p != delim) {
319 ++p;
320 continue;
321 }
322 values->emplace_back(last, static_cast<size_t>(p - last));
323 ++num;
324 ++p;
325 // skip continue delim
326 while (*p == delim) {
327 ++p;
328 }
329 last = p;
330 }
331 if (p > last) {
332 values->emplace_back(last, static_cast<size_t>(p - last));
333 ++num;
334 }
335 return num;
336}
337
338inline int split_string_ptr(const char* str,
339 size_t len,

Callers 1

TESTFunction · 0.85

Calls 1

emplace_backMethod · 0.45

Tested by 1

TESTFunction · 0.68