Skip to main content

padRight

Callable

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

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

    @example
    console.log(web3.utils.padRight('0x123', 10));
    > 0x1230000000

    console.log(web3.utils.padRight('0x123', 10, '1'));
    > 0x1231111111

    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.