This function will leave an input value for a given number of characters using a given fill character, without reducing the input value:
Function LPad(s, l, c) Dim n : n = 0 If l > Len(s) Then n = l - Len(s) LPad = String(n, c) & s End Function
Output:
>>> WScript.Echo LPad(12345, 7, "0") 0012345 >>> WScript.Echo LPad(12345, 3, "0") 12345
Ansgar wiechers
source share