Possible to convert HEX to DEC?

Is there a way to convert a HEX-value to DEC-value?

There is no a built-in function for it. Although it’s possible with an expression. For instance, for a 2-byte hex value the expression could be:

pow(16,0)*(match(mid([Hex], len([Hex])-0, 1), '0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F','|')-1)+
pow(16,1)*(match(mid([Hex], len([Hex])-1, 1), '0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F','|')-1)+
pow(16,2)*(match(mid([Hex], len([Hex])-2, 1), '0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F','|')-1)+
pow(16,3)*(match(mid([Hex], len([Hex])-3, 1), '0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F','|')-1)

The expression picks hex symbols starting from the last and looks its position up in a list of values from 0 to F, then multiplies by a power of 16, and sums everything up.

See the example attached.
hex2dec.morph (2.0 KB)


1 Like

Thanks, great!