HexToInt

Submitted by:J Kamy81

Date added:20 March, 2018

Category:Delphi

Converts the given hexadecimal string to an integer.

Tags: string , hexadecimal , integer

Code Snippet:

function HexToInt(const HexStr: string): Integer;
{$IFDEF FPC}
const
{$ELSE}
resourcestring
{$ENDIF}
sHexConvertError = '''%s'' is not a valid hexadecimal value';
begin
if not TryHexToInt(HexStr, Result) then
raise SysUtils.EConvertError.CreateFmt(sHexConvertError, [HexStr]);
end;
 
 

Comments