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. Is there any method in qt class which validate a string content for hexadecimal or not?
Forum Updated to NodeBB v4.3 + New Features

Is there any method in qt class which validate a string content for hexadecimal or not?

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

    Hi,

    I've made some custom methods to validate the string is a hexadecimal or not. But, couldn't find anything in Qt to do that or maybe I've overlooked.

    Is there any method from Qt class to do this operation?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You could use "toLongLong":http://doc.qt.nokia.com/4.7/qstring.html#toLongLong or similar routines. However, this will allow you to check only part of the string. You may to iterate.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rahul Das
        wrote on last edited by
        #3

        @ QString str = "FF";
        bool ok;
        qint64 hex = str.toLongLong(&ok, 16); @

        Is there in the doc. As you see, the base is 16. returns 0 on failure or the hex number.


        Declaration of (Platform) independence.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          feedmeqt
          wrote on last edited by
          #4

          well, I thought like "isxdigit()" similar function would be there .

          Guys, tanx!!!

          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