MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / SplitString

Function SplitString

test/common/gtest/gtest.cpp:8138–8153  ·  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

8136// vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
8137// ::std::string, so we can use it here.
8138static void SplitString(const ::std::string& str, char delimiter,
8139 ::std::vector< ::std::string>* dest) {
8140 ::std::vector< ::std::string> parsed;
8141 ::std::string::size_type pos = 0;
8142 while (::testing::internal::AlwaysTrue()) {
8143 const ::std::string::size_type colon = str.find(delimiter, pos);
8144 if (colon == ::std::string::npos) {
8145 parsed.push_back(str.substr(pos));
8146 break;
8147 } else {
8148 parsed.push_back(str.substr(pos, colon - pos));
8149 pos = colon + 1;
8150 }
8151 }
8152 dest->swap(parsed);
8153}
8154
8155# if GTEST_OS_WINDOWS
8156// Recreates the pipe and event handles from the provided parameters,

Callers 1

Calls 3

AlwaysTrueFunction · 0.85
push_backMethod · 0.80
swapMethod · 0.45

Tested by

no test coverage detected