Menu

Hex string to Long integer

Help
Peter
2018-02-10
2018-02-10
  • Peter

    Peter - 2018-02-10

    I have a hex number as a string (data comes from a serial port as a string) e.g. "0xABCDEF"

    Is there an easy way to convert this to a long integer?

    val() doesn't work - I think it just returns 0 (from the "0x")
    There is the hex() function for doing it the other way around.

     
  • Anobium

    Anobium - 2018-02-10

    No but this should be relatively simple.
    The target long has the four bytes. Assign the string 2 chars at a time to the 4 bytes of the Long.

     

Log in to post a comment.