Skip to main content

padLeft

Callable

  • padLeft(value: Numbers, characterAmount: number, sign?: string): string

  • Adds a padding on the left of a string, if value is a integer or bigInt will be converted to a hex string.

    @example

    console.log(web3.utils.padLeft('0x123', 10));
    >0x0000000123

    Parameters

    • value: Numbers

      The value to be padded.

    • characterAmount: number

      The amount of characters the string should have.

    • sign: string = '0'

      The sign to be added (default is 0).

    Returns string

    The padded string.