say I have code looking like:
QByteArray param = "two";
QByteArray newStr = "one";
on each append I suppose there is a reallocation taking place. is there a solution taht enables be to have a single alloaction.
reserve seems like uncompurtable option.
I know of QStringBuilder - is there an equivalent for QByteArray?
Hi! You're lucky because
#include <QStringBuilder> #include <QDebug> // ... QByteArray say("say"); QByteArray hello("hello"); QByteArray world("world"); QByteArray message = say % hello % world; qDebug() << message;
See also String concatenation with QStringBuilder by Olivier Goffart.
thanks! thats great. I was not aware of that