What is the equivalent of NumberFormat in JavaScript or JQuery?

痞子三分冷 提交于 2019-11-29 14:04:12

Use the NumberFormatter plug-in for JQuery.

FYI: the old link was here.

I know this doesn't really answers your question, but have you thought of using the jstl formatNumber tag?

Use JSTL <fmt:formatNumber> ... http://www.tutorialspoint.com/jsp/jstl_format_formatnumber_tag.htm

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<fmt:formatNumber type="number" pattern="###0.00" value="${bean.value}" />

Trying using sprintf() for JavaScript.

Ext JS's Format class has a number function you can use to do this, see Ext.util.Format. As of Ext 4 it also supports locale-specific "thousand separators".

I guess the downside is that you need to import part of the Ext framework to use it!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!