There are several ways to achieve this, but this is probably and possibly the easiest:
main.cpp
#include <QString>
#include <QDebug>
int main()
{
QString string("5+6+7");
qDebug() << string.section('+', 0, 0) << string.section('+', 1);
return 0;
}
main.pro
TEMPLATE = app
TARGET = main
QT = core
SOURCES += main.cpp
Assembly and launch
qmake && make && ./main
Output
"5" "6+7"
lpapp source
share