[QRegExp] Parse a double string from the QString



  • Hello,
    Does someone know how to parse the 6844.823501 from the bellow string using QRegExp?

    QString str = " RenderThread-1171 ( 785) [002] ...1 6844.823501: tracing_mark_write: B|785|queue mFrameCallbackTask"

    Thanks in advance



  • Hey,

    you could use an expression like this:

    @QString str = "RenderThread-1171 ( 785) [002] …1 6844.823501: tracing_mark_write: B|785|queue mFrameCallbackTask";
    QRegExp exp("[1-9]\.[0-9]");
    int i = exp.indexIn(str);
    if (i > 0)
    qDebug() << exp.cap();@

    Best regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.