如何使用JavaScript和jQuery解析20位数字 [英] How to parse 20 digit number using JavaScript and jQuery

查看:90
本文介绍了如何使用JavaScript和jQuery解析20位数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用JavaScript和jQuery解析一个20位的数字?

How do I parse a 20-digit number using JavaScript and jQuery?

推荐答案

一个20位的数字通常也是如此对于JavaScript本机数字类型来说很重要,因此您需要找到要使用的大数字包。这是我在Stack  Overflow上看到过的一个看起来很有趣的内容: http://silentmatt.com/biginteger/

A 20-digit number is generally too big for a JavaScript native numeric type, so you'll need to find a "big number" package to use. Here's one that I've seen mentioned on Stack Overflow and that looks interesting: http://silentmatt.com/biginteger/

那只是整数。如果你也需要小数分数,你必须找到别的东西。

That one is just integers. If you need decimal fractions too, you'll have to find something else.

如果你只是想检查一个20位数的字符串是什么样的一个数字,你不需要知道这个值,你可以用正则表达式来做。

If you just want to check that a 20-digit string looks like a number, and you don't need to know the value, you can do that with a regular expression.

这篇关于如何使用JavaScript和jQuery解析20位数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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