3.5.11.10 Hex2Dec


Description

Convert a string representation of a hexadecimal number to decimal.

Beginning with Origin 2019, the "0x" prefix is supported (see Examples). Additionally, Origin worksheets and matrices now support display of hexadecimal numbers.

Syntax

int Hex2Dec(string str$)

Parameters

str$

The string of hexadecimal to convert to decimal.

Return

Return the decimal of the specified hexadecimal.

Example

hex2Dec(2B) = ;  // 43

string strHex$ = FE4;
int n = hex2Dec(strHex$);
n = ;  // 4068
aa$=0x12312340002;
Hex2Dec(aa$)=; // prefix "0x"
bb$=12312340002;
Hex2Dec(bb$)=; // no prefix "0x"
Hex2Dec(aa$)=1250140880898
Hex2Dec(bb$)=1250140880898

See Also

Bin2Dec, Dec2Bin, Dec2Hex