最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

extjs4 - Formatting numbers through ExtJS or javascript - Stack Overflow

programmeradmin0浏览0评论

I am using string.Format() to format some numbers at the server side.

double dd = 15453434.5345;
            Console.Write(String.Format("{0:N0}", dd));
            Console.Read();

Above code generates:

15,453,435

The number is rounded off and we can see ma separator. How can I achieve this using ExtJS.

I am using string.Format() to format some numbers at the server side.

double dd = 15453434.5345;
            Console.Write(String.Format("{0:N0}", dd));
            Console.Read();

Above code generates:

15,453,435

The number is rounded off and we can see ma separator. How can I achieve this using ExtJS.

Share Improve this question asked Jun 5, 2013 at 9:09 SharpCoderSharpCoder 19.2k43 gold badges163 silver badges258 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Take a look at Ext.util.Format.

This class is a centralized place for formatting functions. It includes functions to format various different types of data, such as text, dates and numeric values.

Options include:

  • thousandSeparator
  • decimalSeparator
  • currenyPrecision
  • currencySign
  • currencyAtEnd

Example:

Ext.util.Format.thousandSeparator = ',';
Ext.util.Format.decimalSeparator = ',';
var num = (15453434.5345).toFixed(0);

//And then:
Ext.util.Format.number(num, '0,000.00'); //outputs 15,453,435
发布评论

评论列表(0)

  1. 暂无评论