ppap4lmp  0.7.2
join.cpp
Go to the documentation of this file.
1 
8 #include "join.h"
9 
10 namespace ut = utils;
11 
12 /* ------------------------------------------------------------------ */
13 
15  const Vec<Str> &strs,
16  const Str &jointer)
17 {
18  Str tmp;
19 
20  if (!strs.empty())
21  {
22  tmp = strs.front();
23 
24  for (auto it = strs.cbegin()+1; it != strs.cend(); ++it)
25  {
26  tmp += jointer + *it;
27  }
28  }
29 
30  return tmp;
31 }
This file has a definition of utils::join.
std::string Str
Str is an alias for string.
Definition: std.h:21
std::vector< T > Vec
Vec is an alias for vector (same as list in Python).
Definition: std.h:27
Str join(const Vec< Str > &strs, const Str &jointer)
Mimicking Python&#39;s join.
Definition: join.cpp:14
Namespace for utility functions.
Definition: join.h:14