Skip to main content

Zfill

zfill (Function)​

Format​

zfill ( string_expression, length_expression)

returns string_expression

Description​

Return a right justified string of at least length_expression characters, with zeros added on the left. A number is turned into a string first, and a string that is already long enough is returned as it is. A minus sign is treated like any other character, so zfill(-5, 4) is "00-5". It is equivalent to rjust ( string_expression, length_expression, “0”).

Example​

print zfill(7, 3)
print zfill("42", 5)
print zfill(12345, 3)

will display

007
00042
12345

See Also​

Asc, Chr, Count, Countx, Explode, Explodex, Implode, Instr, Instrx, Left, Length, Ljust, Lower, LTrim, MD5, Mid, Midx, Replace, Replacex, Right, Rjust, RTrim, Serialize, String, Trim, Unserialize, Upper, Zfill

History​

2.0.0New To Version