Function strPadStart

  • The strPadStart() method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string. This will use any native implementation if available, but will fall back to the provided polyfill for runtimes that don't support padStart

    Parameters

    • value: string

      The value to be padded

    • targetLength: number

      The length of the resulting string once the current str has been padded. If the value is less than str.length, then str is returned as-is.

    • Optional padString: string

      The string to pad the current str with. If padString is too long to stay within the targetLength, it will be truncated from the end. The default value is the unicode "space" character (U+0020).

    Returns string