How can I convert a string containing a hex number such as "6b" to a hex digit that mathematica can use to do math with?
I have tried using ToExpression["6b"] but that just give me another string.
Note: Java's BigIntegerclass can construct hex integers from strings. Is there something like this in mathematica?
Answer
The function converting strings to integer is FromDigits. It is the counterpart of IntegerString and both functions can be used with whatever basis you like. Therefore, if you want to convert from base 16 you do
FromDigits["6b", 16]
Comments
Post a Comment