39 lines
848 B
Plaintext
39 lines
848 B
Plaintext
|
|
||
|
{{alias}}( str, len[, pad] )
|
||
|
Left pads a `string` such that the padded `string` has a length of at least
|
||
|
`len`.
|
||
|
|
||
|
An output string is not guaranteed to have a length of exactly `len`, but to
|
||
|
have a length of at least `len`. To generate a padded string having a length
|
||
|
equal to `len`, post-process a padded string by trimming off excess
|
||
|
characters.
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
str: string
|
||
|
Input string.
|
||
|
|
||
|
len: integer
|
||
|
Minimum string length.
|
||
|
|
||
|
pad: string (optional)
|
||
|
String used to pad. Default: ' '.
|
||
|
|
||
|
Returns
|
||
|
-------
|
||
|
out: string
|
||
|
Padded string.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var out = {{alias}}( 'a', 5 )
|
||
|
' a'
|
||
|
> out = {{alias}}( 'beep', 10, 'b' )
|
||
|
'bbbbbbbeep'
|
||
|
> out = {{alias}}( 'boop', 12, 'beep' )
|
||
|
'beepbeepboop'
|
||
|
|
||
|
See Also
|
||
|
--------
|
||
|
|