当前位置:网站首页>JS convert numbers to uppercase
JS convert numbers to uppercase
2022-07-23 23:23:00 【Much larger than 369】
transCnMoney(number){
var CN_MONEY = "";
var CN_UNIT = " Ten billion yuan and ten thousand yuan and ten cents ";
number = parseFloat(number).toFixed(2).toString();// The browser defaults to integer , Change the number to 2 Of significant digits float Type to string
var dot = number.indexOf('.');// Will be separated from the decimal point
if(dot >=0){
number = number.substring(0,dot)+number.substr(dot+1,2);
CN_UNIT=CN_UNIT.substr(CN_UNIT.length-number.length);
for (var i = 0; i < number.length; i++){
CN_MONEY += ' One two three four five six seven eight nine '.substr(number.substr(i, 1), 1) + CN_UNIT.substr(i, 1);
}
return CN_MONEY.replace(/ Zero angle, zero point $/, ' whole ').replace(/ zero [ Thousand hundred and ten ]/g, ' zero ').replace(/ zero {2,}/g, ' zero ').replace(/ zero ([ Billion | ten thousand ])/g, '$1').replace(/ zero + element /, ' element ').replace(/ 100 million {0,3} ten thousand /, ' Billion ').replace(/^ element /, " zero yuan ");
}else{
}
},
边栏推荐
- Sql156 average completion rate of each video
- 1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
- 二,数字逻辑功能单元
- Lin Zhiying's injury is relatively stable
- Use boundschecker "suggestions collection"
- Crazy God redis notes 10
- Contemporary inspirational "women"
- Basic operations of AutoCAD
- ES6 use of arrow function
- Upgrade unity visual studio 2019 to 2022 (throw away pirated red slag)
猜你喜欢

难怪国内企业ERP应用效果普遍不理想

After reading this article, thoroughly understand grpc!

How does the easynvr platform turn off anonymous login?
![[tensorflow] check whether tensorflow GPU is available](/img/27/e2b21b0a0cecdff27ddd2af6e34949.png)
[tensorflow] check whether tensorflow GPU is available

Three network modes of VMware virtual machine

unity visual studio2019升级到2022版本(扔掉盗版红渣)

Mongodb - Introduction to the use of $exists and the combination of $ne, $nin, $nor, $not in query statements

Lin Zhiying's injury is relatively stable

The role of physical layer, link layer, network layer, transport layer and application layer of tcp/ip model of internet protocol stack

PHP(2)
随机推荐
[leetcode ladder] the penultimate node in the 022 linked list
FL Studio 20.9 update Chinese version host Daw digital audio workstation
Stm32f4 check the frequency of each part of the system
This article will show you what typescript is
[web vulnerability exploration] SQL injection vulnerability
PHP(2)
Light up the LED light of little bear patting learning
Mongodb - Introduction to the usage of logical operators not, and, or, nor in query statements
dried food! Implicit sparse regularization effect in neural networks
Interviewer: if the order is not paid within 30 minutes after it is generated, it will be automatically cancelled. How to realize it?
砺夏行动|源启数字化:既有模式,还是开源创新?
Flask框架中如何进行数据库的迁移
The I2C interface mode offline burning operation method of h7-tool has been released (2022-07-16)
Tap series article 7 | easy to manage pipeline configuration
Open source embedded sig in the openeuler community. Let's talk about its multi OS hybrid deployment framework
cannot meet the needs of the people? How can programmers take private jobs to effectively increase their income?
Quickly learn to use file permissions
Matlab Foundation
Tensorflow one layer neural network training handwritten digit recognition
Mongodb - Introduction to the use of $exists and the combination of $ne, $nin, $nor, $not in query statements