Skip to main content



  • 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.


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


    • 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.