From ZCubes Wiki
Jump to navigation Jump to search

  • where is the input string,
  • is the number or a string or a character with which the given string is to be padded.
  • is the total length of the resultant string.


  • This function pads the given string with mentioned string or character or number till is satisfied.
  • For non-numeric value of , it should be mentioned in double quotes.

e.g ZeroPad("##",4,6) displays 4444##.

  • can be a number, a character or a string. Non-numeric value should be mentioned in double quotes.

e.g ZeroPad(55,"z",9) displays zzzzzzz55.

  • If is lesser than the actual length of the string, it is ignored and the string is displayed as it is.

e.g ZeroPad(567,"z",1) displays 567.


  1. =ZeroPad(4,0,6) = 000004
  2. =ZeroPad(678,"a",8) = aaaaa678
  3. =ZeroPad("#@$",1,5) = 11#@$
  4. =ZeroPad(99,45.5,5) = 45.545.545.599
  5. =ZeroPad("World","Hello",15) = HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloWorld

Related Video

How to add leading Zeros

See Also