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. Stl search equivalent
Qt 6.11 is out! See what's new in the release blog

Stl search equivalent

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.6k 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.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    Hi
    Is there a Qt equivalent to the stl search algorithm?
    I want to find sequences that occur ion other sequences

    Thanks for your time

    1 Reply Last reply
    0
    • B Offline
      B Offline
      broadpeak
      wrote on last edited by
      #2

      http://doc.qt.digia.com/qq/qq15-qalgorithms.html

      or

      http://doc.qt.digia.com/4.7.1/qtalgorithms.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GrahamL
        wrote on last edited by
        #3

        If i read correctly these searches operate on a single value whereas I want to find a sequence of values
        FOr example if my list is

        A B C D B C B C X Y Z

        I want to find all occurrences of the sequence B C

        1 Reply Last reply
        0
        • ZlatomirZ Offline
          ZlatomirZ Offline
          Zlatomir
          wrote on last edited by
          #4

          Quote from the documentation link:
          If STL is available on all your target platforms, you can use the STL algorithms instead of their Qt counterparts. One reason why you might want to use the STL algorithms is that STL provides dozens and dozens of algorithms, whereas Qt only provides the most important ones, making no attempt to duplicate functionality that is already provided by the C++ standard.

          So, use std::search, unless you have a good reason not to (then tell us your specific case)

          https://forum.qt.io/category/41/romanian

          1 Reply Last reply
          0
          • B Offline
            B Offline
            broadpeak
            wrote on last edited by
            #5

            indexOf of QString isn't good?

            @
            QString str = "We must be <b>bold</b>, very <b>bold</b>";
            int j = 0;

            while ((j = str.indexOf("<b>", j)) != -1) {
            qDebug() << "Found <b> tag at index position" << j;
            ++j;
            }
            @

            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