...

View Full Version : appending a zero



ellcon
07-25-2002, 02:23 PM
Hi, I need to know how to append a zero to the front of a number. For example, how to change 6 into 06.
Thanks
-Ian

tamienne
07-25-2002, 02:30 PM
iNum = 6;
paddedNum = "0" + iNum;

===============


iNum = 6;
iPaddedLength = 2;
paddedNum = ""+iNum;
while (paddedNum.length < iPaddedLength) {
paddedNum = "0" + paddedNum;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum