» Help

Code Snippets Database

Control Box
 
 

Requested snippet

This page displays the requested HexToInt snippet.

You can choose a category, perform a search or generate a Pascal unit containing the snippet by using the Control Box.

HexToInt
Converts a hexadecimal string to an integer. Raises an exception if the string is not valid hexadecimal.
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;
Kind of Snippet: Routine
Required units: None.
Required snippets: TryHexToInt.
Supported Compilers:
 D2   D3   D4   D5   D6   D7  D2005
(Win32)
D2006
(Win32)
D2007 D2009
(Win32)
D2010
(Win32)
Free
Pascal
Red LED Red LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED