Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第309题(2020-09-22):实现格式化输出,比如输入 999999999,输出 999,999,999? #312

Open
qappleh opened this issue Sep 22, 2020 · 3 comments

Comments

@qappleh
Copy link
Owner

qappleh commented Sep 22, 2020

No description provided.

@qappleh
Copy link
Owner Author

qappleh commented Oct 14, 2020

使用正则:
var f = '99999999999'.replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,');

@xiaoma-FrontEnd
Copy link

@cuo9958
Copy link

cuo9958 commented Nov 5, 2020

'99999999999'.replace(/(?=(\d{3})+$)/g, '$&,')
这个也可以,前面的数字匹配是为了什么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants