What?
There may be other articles out there documenting this but I can't keep trying to find these in Google so referring to my own website, this is a doddle for me to find each time.

Why?
I have to do this so often that it deserves an article. Though writing a whole page for this is probably unwarranted so I may rename this article later to common things I need to do in Zoho Deluge.

How?
So going through the forums you may find the following example:
string padWithLeadingZeros(int finalStringLength, int startingNumber)
{
      return leftpad(toString(input.startingNumber), input.finalStringLength).replaceAll(" ", "0");
}

This looks like pretty old code and not wanting to cause offence, it isn't the JavaScript style or chain I like which appends the functions instead and is clearer for me personally to understand:
// I want 010

v_NextIndex = 10;
// yields 10

v_NextIndexStr = v_NextIndex.leftpad(3);
// yields " 10"

v_NextIndexStr = v_NextIndex.leftpad(3).replaceAll(" ", "0");
// yields "010"

Source(s):