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. [SOLVED] QStringList split RegExp
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QStringList split RegExp

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k Views 2 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.
  • gian71G Offline
    gian71G Offline
    gian71
    wrote on last edited by gian71
    #1

    I have a simple problem but I am having very difficult time to find a solution.
    I am reading from a File line by line and then using QStringLIst.split(" ") to get all the contents of a specific line.
    There are lines where there is something like: 1 "a aaa aaaa" 2 "bbbbb bbb" 3 "cccc"... so there are strings inside the line.
    In this case using " " as RegExp to split a line does not do the Job for me...because I need to get the whole strings inside a line.

    Is there anybody that can give me some suggestions on this topic?

    Thanks

    G.

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

      Hi,

      Can you show an example of text you have and what you would like to have in your QStringList ?

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

      gian71G 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Can you show an example of text you have and what you would like to have in your QStringList ?

        gian71G Offline
        gian71G Offline
        gian71
        wrote on last edited by SGaist
        #3

        @SGaist
        Ok I have just find a solution, I just needed to use split(""");

        Let's say you have this line as QStringList:
        1 "Active" 0 "Not Active"

        Using split(" ") I was not able to keep "Not Active" as single String, I needed split("\"").

        Thanks

        G.

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

          Do you also need the numbers or only the texts ?

          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