Skip to main content

utf8ToHex

Callable

  • utf8ToHex(str: string): string

  • Should be called to get hex representation (prefixed by 0x) of utf8 string

    @example
    console.log(utf8ToHex('web3.js'));
    > "0x776562332e6a73"

    Parameters

    • str: string

      Utf8 string to be converted

    Returns string

    • The hex representation of the input string