Delphi - 10 Hexadecimal conversion

Decimal turn hex

May be implemented using IntToHex hexadecimal to decimal conversion, note here are two parameters, the first decimal number expressed the need to be converted, the conversion expressed by several second to display hexadecimal.

code show as below:

 

function OctToHex(iValue, iBit: Integer): String;
begin
    Result := IntToHex(iValue, iBit);
end;

Turn hex decimal

Use StrToInt 16 hexadecimal to decimal conversion can be achieved.

code show as below:

function HexToOct(hValue: String): Integer;
begin
    Result := StrToInt('$' + hValue);
end;

 

Shihai should be noted that the conversion level of 16-bit hexadecimal question! MSB first or LSB first need to distinguish!

 

Guess you like

Origin www.cnblogs.com/jeremywucnblog/p/11610930.html