pad

Pad a String with another String, to a certain length.


Syntax


Parameters

  • String subject - The String to pad.
  • Number length - The length to pad the String to.
  • String padding - The String to use as padding (defaults to spaces).
  • Number type - Which side(s) to pad.
    • 0 - Pad the left-hand side of subject.
    • 1 (default) - Pad the right-hand side of subject.
    • 2 - Pad both sides of subject.


Result

Returns subject padded on the left, right, or both sides, to the specified length.