openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.95k stars 528 forks source link

Support for number grouping #127

Open spidergears opened 8 years ago

spidergears commented 8 years ago

113

Support grouping of number in 'Indian' and 'Arabic' system Support custom groupSize as well

Defaults to Arabic i.e i groups of 3 accounting.formatNumber(676854399.95678567459, 3, ",", ".") => "676,854,399.957"

accounting.formatNumber(676854399.95678567459, 3, ",", ".", "Indian") => "67,68,54,399.957" accounting.formatNumber(676854399.95678567459, 3, ",", ".", "Arabic") => "676,854,399.957" Custom grouping accounting.formatNumber(676854399.95678567459, 3, ",", ".", "4") => "6,7685,4399.957" accounting.formatNumber(676854399.95678567459, 3, ",", ".", 4) => "6,7685,4399.957"