Navigation :
padLeft
padLeft, function
def const pure padLeft(source: text, pad: text, size: number): text
Prepends pad to source until the result length is at least size. If
size is less than the length of source, no padding is applied.
source: the text to pad.
pad: the text to repeat on the left (must be non-empty).
size: the target length (an integer between 1 and 256).
Example
table T = with
[| as Source, as Pad, as Size |]
[| "1234", "0", 7 |]
[| "1234", "0_", 7 |]
[| "1234", "0__", 7 |]
[| "1234", "0__", 3 |]
T.Result = padLeft(T.Source, T.Pad, T.Size)
show table "Padded text" with
T.Source
T.Pad
T.Size
T.Result
This outputs the following table:
| Source |
Pad |
Size |
Result |
| 1234 |
0 |
7 |
0001234 |
| 1234 |
0_ |
7 |
0_0_1234 |
| 1234 |
0__ |
7 |
0__1234 |
| 1234 |
0__ |
3 |
1234 |