It also depends on how close you want it to be to decimalFormat() or
for that matter lsNumberFormat(n,",.00") (which would be the i18n
equivalent of decimalFormat() afaik)... note that CF's decimalFormat()
also includes commas (which is why there's a comma in the
lsNumberFormat(). This will work for locales that use the dot to
delineate decimal places, if you're not concerned about the commas (or
in some cases dots in say Germany).
decimalFormat
en_US 1000 = 1,000.00
de_DE 1000 = 1.000,00
As I understand it if you need internationalization, you'll have to
either roll your own lsNumberFormat() equivalent in AS or deliver the
value to AS from CF or some other source pre-formatted (my
preference).
> Hey Ken,
> Theres not really a nice way to do this actually.Heres a
> prototype... it
> should do the trick.
> Number.prototype.addCents = function() {
> var a = ((Math.round(this*100)/100)+"").split(".");
> a[1] = (a[1]+"00").substr(0, 2);
> return a.join(".");
> };
> // Usage
> var price = 123.4;
> var discount = 56.8;
> price = price - discount;// 66.6
> total = price.addCents();// 66.60
s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208745
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54