Split QStringList
#include <QStringList>
#include <QDebug>
int main() {
QString winter = "A, B, C";
QString spring = "D, E, F";
QString summer = "G, H, I";
QString fall = "X, Y, Z";
QStringList list;
list << winter;
list += spring;
list.append(summer);
list << fall;
QString allmonths = list.join(", ");
QStringList list2 = allmonths.split(", ");
Q_ASSERT(list2.size() == 12);
foreach (QString str, list) {
qDebug() << QString(" [%1] ").arg(str);
}
return 0;
}
Related examples in the same category