-
Hi,
I tryed this:
<%=format(7,"000")%> in hopes I'd get 007 like in VB
But I got this:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'format'
I need to insure three place holders are taken at all times for any integer 1 to 999. Any Help?
-
asp Vb Script have only few format functions (currency,percent...), but you can write your own format function. For your example:
function format(number,length)
dim i
if len(number)>length then
format="ERR"
else
for i=1 to length-len(number)
format=format & "0"
next
format=format & number
end if
end function
And then in code just call
<%format(7,3)%>
If you wil try to format number in less places then the length of number, you will get ERR.
Hope it helps, Maxi