Re: Formatting numbers for output


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Re: Formatting numbers for output

  1. #1
    ID Guest

    Re: Formatting numbers for output


    "mike viglianco" <michael.viglianco@bankofamerica.com> wrote:
    >
    >How would you format a number to display with leading zeros?
    >For example: 19 as 0000019.
    >
    >I have done this in many languages but cant seem to find out how in VBScript.
    >
    >Thanks,
    >Mike Viglianco


    I'm looking for the same format. Is there a way to do it in JavaScript or
    ASP?

  2. #2
    Steve Berzins Guest

    Re: Formatting numbers for output

    I don't know that is there is anything 'built in', but you can spin your own
    generic string 'padder'....

    Function PadLeft(strIn, padChar, strLen)
    PadLeft = Right(String(strLen, padChar) & strIn, strLen)
    End Function

    Response.Write PadLeft(19, "0", 8)
    Response.End

    "ID" <ismael.dehoyos@crystaldecisions.com> wrote in message
    news:3b0a83fc$1@news.devx.com...
    >
    > "mike viglianco" <michael.viglianco@bankofamerica.com> wrote:
    > >
    > >How would you format a number to display with leading zeros?
    > >For example: 19 as 0000019.
    > >
    > >I have done this in many languages but cant seem to find out how in

    VBScript.
    > >
    > >Thanks,
    > >Mike Viglianco

    >
    > I'm looking for the same format. Is there a way to do it in JavaScript or
    > ASP?




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center