Results 1 to 2 of 2

Thread: Format a number

  1. #1

    Thread Starter
    Frenzied Member dinosaur_uk's Avatar
    Join Date
    Sep 2004
    Location
    Jurassic Park
    Posts
    1,098

    Format a number

    Hi there how can i format a number so that if it is :

    1 to return 01
    and 14 to leave it as it is?

    I cant seem to get it to work on CF

    cheers

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Format a number

    If the problem is as simple as this: The number must be two digits, padded with 0's as need be.

    Then I'd be tempted to just write my own function:

    VB Code:
    1. public function FormatString(st1 as string) as string
    2.  if st1.length=1 then
    3.   st1 = "0" & st1
    4.  end if
    5.  formatstring=st1
    6. end function
    My usual boring signature: Nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width