z-number-format
Install
npm install z-number-format --save
params
Param | Options | Default | Description |
---|---|---|---|
number | number string or number | none | which number need to format |
type | One of ['thousand', 'lakh', 'wan'] | thousand | Define the thousand grouping style, It support three types. thousand style (thousand) : 123,456,789 , indian style (lakh) : 12,34,56,789 , chinese style (wan) : 1,2345,6789 |
separator | separator | , | Sets the thousands/wan/laxh separator. |
import
// es6 module; // node modulevar numberFormat = ; // cdn Available on unpkg or 74b<script src="https://unpkg.com/z-number-format@2.0.3/src/index.js"></script> <script src="https://74b.cc/js/zNumberFormat.js"></script>
typescript
Supports typescript
use it in website
declare global function numberFormat
<script src="https://74b.cc/js/zNumberFormat.js"></script>
Examples
var numberFormat = ;;
Output : 123,456
// format a floatvar numberFormat = ;;
Output : 123,456.12345
var numberFormat = ;;
Output : 123,456
var numberFormat = ;;
Output : 12,3456
var numberFormat = ;;
Output : 12-3456
var numberFormat = ;;
Output : 30,00,000