Unit 'StrUtils' Package
[Overview][Resource strings][Constants][Types][Procedures and functions][Index] [#rtl]

HexToBin

Convert a hexadecimal string to a binary buffer.

Declaration

Source position: strutils.pp line 251

function HexToBin(

  HexText: PAnsiChar;

  BinBuffer: PAnsiChar;

  BinBufSize: Integer

):Integer; overload;

function HexToBin(

  const HexText: PWideChar;

  HexTextOffset: Integer;

  var BinBuffer: TBytes;

  BinBufOffset: Integer;

  Count: Integer

):Integer; overload;

function HexToBin(

  const HexText: TBytes;

  HexTextOffset: Integer;

  var BinBuffer: TBytes;

  BinBufOffset: Integer;

  Count: Integer

):Integer; overload;

function HexToBin(

  HexText: PWideChar;

  BinBuffer: Pointer;

  BinBufSize: Integer

):Integer; overload;

function HexToBin(

  const HexText: PWideChar;

  var BinBuffer;

  BinBufSize: Integer

):Integer; overload;

function HexToBin(

  HexText: PWideChar;

  BinBuffer: PAnsiChar;

  BinBufSize: Integer

):Integer; overload;

function HexToBin(

  HexText: PAnsiChar;

  var BinBuffer;

  BinBufSize: Integer

):Integer; overload;

function HexToBin(

  const HexText: PAnsiChar;

  BinBuffer: Pointer;

  BinBufSize: Integer

):Integer; overload;

Description

HexToBin scans the hexadecimal string representation in HexValue and transforms every 2 character hexadecimal number to a byte and stores it in BinValue. The buffer size is the size of the binary buffer. Scanning will stop if the size of the binary buffer is reached or when an invalid character is encountered. The return value is the number of stored bytes.

Errors

No length checking is done, so if an invalid size is specified, an exception may follow.

See also

BinToHex

  

Convert a binary buffer to a hexadecimal string.


Documentation generated on: Nov 24 2024