Is there a builtin Mathematica function to read hexadecimals in 0-9,a-f format?
Is there a builtin Mathematica function that parses strings representing numbers in hexadecimal form, e.g. "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 must be a more robust builtin function wi开发者_如何学运维th error checking that I just cannot find.
FromDigits[]
can already work with strings.
In[7]:= FromDigits["89ab", 16]
Out[7]= 35243
精彩评论