<%
'Xdigits
Function
'Say
you need to have a count in a dynamically generated table that must have 3
digits,
'or
a value for the day of the month that must be displayed as two digits.
'XDigits
can format an integer or string of integers to have as many zeros to the left
of it to fit a specified length.
'The
parameters for XDigits are: sNumberString, the integer or string integers that
need to be formatted; and nReturnLength, the length of the string returned by
the function. If nReturnLength is less than the length of sNumberString,
XDigits will return the rightmost digits in sNumberString fitting nReturnLength.
'Usage:
'XDigits("24",4)
'Returns "0024"
'XDigits(58,3)
'Returns "058"
'XDigits("1999",2)
'Returns "99"
'********************************
Function
XDigits(sNumberString, nReturnLength)
If
nReturnLength > Len(sNumberString) Then
XDigits
= String(nReturnLength - Len(sNumberString), "0") & sNumberString
Else
XDigits
= Right(sNumberString, nReturnLength)
End
If
End
Function
'********************************
%>