personally I'd like to see how to get DecimalFormat to work right...

I'm given a range of numbers between 100000 and 0.000001..  I'd like to nice
format it eg:

1000.000000: 1000
 100.000000: 100
    .100000: 0.1

I've tired NumberFormat and DecimalFormat (with a mask of ______.______) and
neither has worked

Any ideas?

Thanks!
hatton

> -----Original Message-----
> From: Dave Carabetta [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 20, 2002 11:29 PM
> To: CF-Talk
> Subject: Re: Not Rounding Decimals
>
>
> > We have some numbers to display that have 5 decimal places in
> the Database
> > but we only want to display two of the decimal places but
> without rounding
> > the up or down, in other words 10.69751 needs to display as
> 10.69.  Using
> > Number( or LSNumber( and masks rounds the number up or down.
> >
> > Anyone got any ideas on this?
> >
>
> Man, this is an ugly way to do it, but the only way off the top
> of my head.
> Cut and paste this one to see the output:
>
> <cfset number = 10.298765>
> <cfset wholenumber = ListFirst(number, ".")>
> <cfset decimal = Left(ListGetAt(number, 2, "."), 2)>
> <cfset newnumber = wholenumber & "." & decimal>
>
> <cfoutput>#newnumber#</cfoutput>
>
> Just a thought. I tried things like ToString() thinking that
> would help, but
> CF still rounds it. I'd be curious to see other solutions, if any, myself.
>
> Regards,
> Dave.
> 
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to