Options
All
  • Public
  • Public/Protected
  • All
Menu

Module padStart

Index

References

Functions String

References

Renames and re-exports __type

String Functions

  • padStart(string?: string, length?: number, chars?: string): string
  • Pads string on the left side if it's shorter than length. Padding characters are truncated if they exceed length.

    since

    5.12.0

    example
    padStart('abc', 6)
    // => ' abc'

    padStart('abc', 6, '_-')
    // => '_-_abc'

    padStart('abc', 2)
    // => 'abc'

    Parameters

    • string: string = ""

      The string to pad.

    • length: number = 0

      The padding length.

    • chars: string = " "

      The string used as padding.

    Returns string

    Returns the padded string.