All I\'ve found is boost::algorithm::string::join
. However, it seems like overkill to use Boost only for join. So maybe there are some time-tested recipes?
If you use Qt in your project you can directly use the join
function of QString (QString Reference) and it works as expected from python. Some examples:
QStringList strList;
qDebug() << strList.join(" and ");
Result: ""
strList << "id = 1";
qDebug() << strList.join(" and ");
Result: "id = 1"
strList << "name = me";
qDebug() << strList.join(" and ");
Result: "id = 1 and name = me"