在javascript中将数字格式化为货币字符串?
我想用JavaScript格式化一个价格 ->250012 应该是 ->2.500,12 看法在javascript中将数字格式化为货币字符串?,javascript,Javascript,我想用JavaScript格式化一个价格 ->250012 应该是 ->2.500,12 看法 @LabelFor(model=>model.Price,htmlAttributes:new{@class=“controllabel col-md-2”}) @EditorFor(model=>model.Price,new{htmlAttributes=new{@class=“form control”}) @Html.ValidationMessageFor(model=>model.Pri
@LabelFor(model=>model.Price,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.Price,new{htmlAttributes=new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Price,“,new{@class=“text danger”})
>常数编号=250012;
>(数字/100)。toLocaleString('de-de')
< "2.500,12"
有关浏览器支持和更多信息,请参阅。您确定不想用Razor而不是Javascript格式化价格吗?使用搜索功能:是。我已经调查过了,但我做不到。
<div class="form-group">
@Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })
</div>
</div>
> const number = 250012;
> (number/100).toLocaleString('de-DE')
< "2.500,12"