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.
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.
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.
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.