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. How to ensure "%1" like string do have a value ?

How to ensure "%1" like string do have a value ?

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

    Hi,

    I wanted to let user configure something manually , and user input must have a "%1" and a "%2" inside , and no other "%X" , so that i could use QString::arg() to build the whole string.

    But how can i ensure there is and only is two parameters ?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yasin
      wrote on last edited by
      #2

      Use "Qt Regular Expressions":http://developer.qt.nokia.com/doc/qt-4.8/qregexp.html

      Yasin Gorgij

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        I think it would be better not to use %1 for this. Qt itself also doesn't (for things like QProgressBar you use %p and the likes). Using numbers is not very readable, using letters a (bit) more so. Also, be careful in your parsing, as the user may want to use a real % sign in the text.

        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