Is there a built-in Mathematica function for reading hexadecimal numbers in the format 0-9, af?

Is there a built-in Mathematica function that parses strings representing numbers in hexadecimal form, for example. "89ab"?

I could use

FromDigits[
 ToExpression[Characters["89ab"] /. 
       Thread[CharacterRange["a", "f"] -> Range[10, 15]]], 
 16
]

or even

ToExpression["16^^" <> "89ab"]

but I'm sure there should be a more robust built-in function with error checking that I just can't find.

+3
source share
1 answer

FromDigits[] can already work with strings.

In[7]:= FromDigits["89ab", 16]

Out[7]= 35243
+8
source

All Articles