MCPcopy Create free account
hub / github.com/apache/singa / SplitString

Function SplitString

test/gtest/gtest-all.cc:7702–7717  ·  view source on GitHub ↗

Splits a given string on a given delimiter, populating a given vector with the fields. GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use it here.

Source from the content-addressed store, hash-verified

7700// vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
7701// ::std::string, so we can use it here.
7702static void SplitString(const ::std::string& str, char delimiter,
7703 ::std::vector< ::std::string>* dest) {
7704 ::std::vector< ::std::string> parsed;
7705 ::std::string::size_type pos = 0;
7706 while (::testing::internal::AlwaysTrue()) {
7707 const ::std::string::size_type colon = str.find(delimiter, pos);
7708 if (colon == ::std::string::npos) {
7709 parsed.push_back(str.substr(pos));
7710 break;
7711 } else {
7712 parsed.push_back(str.substr(pos, colon - pos));
7713 pos = colon + 1;
7714 }
7715 }
7716 dest->swap(parsed);
7717}
7718
7719# if GTEST_OS_WINDOWS
7720// Recreates the pipe and event handles from the provided parameters,

Callers 1

Calls 1

AlwaysTrueFunction · 0.85

Tested by

no test coverage detected