Hello,

I'm displaying some moderately small decimals. I need to "undo" the scientific format 
these decimals normally display in and print ALL the leading zeroes, followed by the 
first two significant digits. Here are some examples:

0.001 --> 0.001
5.3E-4 --> 0.00053
6.428E-5 --> 0.000064
2.0 E-6 --> 0.000002

I've messed around with NumberFormat(), and some regular expressions, to no avail. 
Here is the code I currently have. It's almost there but sometimes it picks up an 
extra non-zero. And it would be nice to figure out some code that's more readable too:

0.#RepeatString( "0", Abs(Int(Log10(someValue))) - 1 )##REReplace( someValue, 
"\.0*([0-9]{0,2}).*", "\1" )#

This results in the following:
0.001 --> 0.0001
5.3E-4 --> 0.00053
6.428E-5 --> 0.0000642
2.0E-6 --> 0.000002

Don't ask how that RepeatString got in there.

Any ideas?


____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to