Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Parsing strings with QT
Qt 6.11 is out! See what's new in the release blog

Parsing strings with QT

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Is there any simple and elegant way to parse strings like this:

    0R1,Dn=090D,Dm=116D,Dx=167D,Sn=0.0M,Sm=0.0M,Sx=0.1M
    0R2,Ta=23.4C,Ua=46.9P,Pa=996.0H
    0R3,Rc=0.00M,Rd=0s,Ri=0.0M,Hc=0.0M,Hd=0s,Hi=0.0M
    0R5,Th=23.9C,Vh=0.0N,Vs=24.3V,Vr=3.494V

    in QT? The line consists from command, then comma and after then field names with equations separated by commas.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Depends on what you want to get from your parsing. e.g.

      @QStringList elementList = myString.split(',');@

      and you have a list containing each element.

      You can also use regular expressions with QRegularExpression or QRegExp if you're on Qt 4

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved