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

Function join_strings

nanofi/tests/CLogAggregatorTests.cpp:50–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50std::string join_strings(const std::vector<std::string>& strings, const std::string& token) {
51 if (strings.empty()) {
52 return "";
53 }
54
55 if (strings.size() == 1) {
56 return strings.at(0);
57 }
58 const auto& initialValue = strings.at(0);
59 return std::accumulate(strings.begin()+1, strings.end(), initialValue,
60 [token,initialValue](const std::string& s1, const std::string& s2) {
61 return s1 + token + s2;
62 });
63}
64
65/****
66 * ##################################################################

Callers 1

Calls 4

emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected