16,203
社区成员
发帖
与我相关
我的任务
分享
#include <QRegExp>
#include <QDebug>
QString str = "1720 * 1080";
QRegExp rx("(\\d+)"); // 匹配数字
int pos = 0;
while ((pos = rx.indexIn(str, pos)) != -1) {
qDebug()<<rx.cap(0).toInt();
pos += rx.matchedLength();
}
中间可以是任意符号或者字符。