Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Hex

This class provides methods for handling hex strings.

export

Hierarchy

  • Hex

Index

Constructors

Methods

Constructors

constructor

  • new Hex(): Hex

Methods

Static split

  • split(hex: string): null | string[]
  • Splits the given hexadecimal string.

    The input string should not contain spaces and the individual bytes should not be prepended by '0x'.

    Example

    Input:

    'AABBCCDDEEFF'
    

    Output:

    ['AA', 'BB', 'CC', 'DD', 'EE', 'FF']
    
    static

    Parameters

    • hex: string

      The hexadecimal string to split.

    Returns null | string[]

    An array of hex strings.

Static toHexString

  • toHexString(array: number[], uppercase?: boolean): null | string
  • Converts the given array of numbers to a hexadecimal string.

    static

    Parameters

    • array: number[]

      The array to convert.

    • Optional uppercase: boolean

      Whether the string should be uppercase.

    Returns null | string

    The given array of numbers as a hexadecimal string.

Static validate

  • validate(hex: string): boolean
  • Validates the given hexadecimal string.

    static

    Parameters

    • hex: string

      The hexadecimal string to validate.

    Returns boolean

    Whether the given string is a valid hexadecimal string.

Generated using TypeDoc