+2
Completed

new function: pad

Shawn 2 years ago • updated by MAPJe71 1 year ago 5

"pad" -- should have two parameters, 1st indicates character to pad with (space, zero, letter, comma or so on) and 2nd indicates total length that should be padded to. The value should never be clipped to less than the length of the original input. Here's some examples:

input command output
0 {input:pad:0:5} 00000
2 {input:pad:0:3} 002
2 {input:pad:0:2} 02
202 {input:pad:0:3} 202
202 {input:pad:0:2} 202
202 {input:pad:0:5} 00202
BEEF {input:pad:F:8} FFFFBEEF

This function will eliminate 2 variables for each time I have to massage version numbers.


Answer

Answer
Completed

Functions will be padleft and padright. First argument is the length, second argument is the optional character (if not specified, space).

If this gets implemented, there should be two functions though, one for padding to the left and one for padding to the right.

Agreed, padstart / padend like trimstart / trimend

Answer
Completed

Functions will be padleft and padright. First argument is the length, second argument is the optional character (if not specified, space).

Version 1.8.7 and higher.