Format Number

Results 1 to 2 of 2

Thread: Format Number

  1. #1
    Join Date
    Dec 1969

    Default Format Number

    How can I format a number to get 3 digits???<BR><BR>I use a random function and I get the random number but now I want to convert that number to a 3 digits number<BR>How can I format that result to get :<BR>Eg: For 12 I want to get 012<BR> For 6 I want to get 006<BR><BR>Thankx

  2. #2
    Join Date
    Dec 1969

    Default RE: Format Number

    Function FormatNumber(strNumberToFormat, intNumberOfPlaces)<BR> if IsNumeric(intNumberOfPlaces) = False then<BR> Exit Function<BR> end if<BR> if Len(strNumberToFormat) &#062;= CInt(intNumberOfPlaces) then<BR> FormatNumber = strNumberToFormat<BR> end if<BR> while Len(strNumberToFormat) &#060; CInt(intNumberOfPlaces)<BR> strNumberToFormat = "0" & strNumberToFormat<BR> wend<BR> FormatNumber = strNumberToFormat<BR>End Function<BR><BR>Craig...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts