更改小数点 [英] Change decimal mark

查看:139
本文介绍了更改小数点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的浏览器中测试一些函数,但不知道在哪里切换设置,以便小数点标记改变。

 (1.53).toLocaleString()

返回1,53喜欢看到美国版本1.53)

在Windows中,我已经改变了地区和语言下的小数点,但它似乎并没有影响浏览器。任何想法?

解决方案

传递 locales BCP 47语言标签,或这样的字符串数组)到 toLocaleString

 的console.log((1.53).toLocaleString( '的en-US'));  


I'd like to test some functions in my browser but don't know where to switch the settings so that the decimal mark changes.

(1.53).toLocaleString()

returns 1,53 (e.g I'd like to see the US version 1.53)

In windows I already changed the decimal mark under region and language but it doesn't seem to affect the browsers. Any ideas?

解决方案

Pass locales argument ("a string with a BCP 47 language tag, or an array of such strings") to toLocaleString:

console.log((1.53).toLocaleString('en-US'));

这篇关于更改小数点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆