MCPcopy Create free account
hub / github.com/arvidn/libtorrent / parse_comma_separated_string

Function parse_comma_separated_string

src/string_util.cpp:332–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330 }
331
332 void parse_comma_separated_string(std::string const& in, std::vector<std::string>& out)
333 {
334 out.clear();
335
336 std::string::size_type start = 0;
337 std::string::size_type end = 0;
338
339 while (start < in.size())
340 {
341 // skip leading spaces
342 while (start < in.size()
343 && is_space(in[start]))
344 ++start;
345
346 end = in.find_first_of(',', start);
347 if (end == std::string::npos) end = in.size();
348
349 // skip trailing spaces
350 std::string::size_type soft_end = end;
351 while (soft_end > start
352 && is_space(in[soft_end - 1]))
353 --soft_end;
354
355 out.push_back(in.substr(start, soft_end - start));
356 start = end + 1;
357 }
358 }
359
360 std::pair<string_view, string_view> split_string(string_view last, char const sep)
361 {

Callers 2

TORRENT_TESTFunction · 0.85

Calls 4

is_spaceFunction · 0.85
push_backMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by 1

TORRENT_TESTFunction · 0.68