subsurface/core/subsurface-string.cpp
Berthold Stoeger 4af2ec88bd Use std::vector<string> instead of QStringList in main()
In an effort to convert core to C++ structures.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00

17 lines
366 B
C++

// SPDX-License-Identifier: GPL-2.0
#include "subsurface-string.h"
std::string join(const std::vector<std::string> &l, const std::string &separator, bool skip_empty)
{
std::string res;
bool first = true;
for (const std::string &s: l) {
if (skip_empty && l.empty())
continue;
if (!first)
res += separator;
res += s;
first = false;
}
return res;
}