当前位置:网站首页>将金额数字转换为大写
将金额数字转换为大写
2022-07-26 06:14:00 【weixin_38673922】
一、效果图:

二、代码块
computeLen(number){
let ret = ''
if (number !== '' && number != null && number !== '0') {
let unit = '仟佰拾亿仟佰拾万仟佰拾元角分'
let str = ''
number += '00'
const point = number.indexOf('.')
if (point >= 0) {
number = number.substring(0, point) + number.substr(point + 1, 2)
}
unit = unit.substr(unit.length - number.length)
for (let i = 0; i < number.length; i++) {
str +=
'零壹贰叁肆伍陆柒捌玖'.charAt(number.charAt(i)) + unit.charAt(i)
}
ret =
str
.replace(/零(仟|佰|拾|角)/g, '零')
.replace(/(零)+/g, '零')
.replace(/零(万|亿|元)/g, '$1')
.replace(/(亿)万|(拾)/g, '$1$2')
.replace(/^元零?|零分/g, '')
.replace(/元$/g, '元') + '整'
}
this.model.taxNotIncludedCapital = ret
},
边栏推荐
- Kingbasees SQL language reference manual of Jincang database (8. Functions (XI))
- 招标信息获取
- Should we test the Dao layer?
- C language explanation series - comprehensive exercises, guessing numbers games
- 【Day04_0421】C语言选择题
- 【Day_07 0425】合法括号序列判断
- 【pytorch】图片增广
- Intelligent fire protection application based on fire GIS system
- [day_060423] no two
- Convolutional neural network (III) - target detection
猜你喜欢

分布式 | 实战:将业务从 MyCAT 平滑迁移到 dble

Traversal of the first, middle, and last order of a binary tree -- Essence (each node is a "root" node)

Viewing the technology stack of distributed system from the crash report of station B
![[the most complete and detailed] ten thousand words explanation: activiti workflow engine](/img/4c/2e43aef33c6ecd67d40730d78d29dc.png)
[the most complete and detailed] ten thousand words explanation: activiti workflow engine

Amd zen4 game God u reached 208mb cache within this year, which is unprecedented

Sequential action localization | fine grained temporal contrast learning for weak supervised temporal action localization (CVPR 2022)

YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
![[day_060423] no two](/img/2b/5bcb3e089a3157fe72a50ddb767e63.png)
[day_060423] no two

Optical quantum milestone: 3854 variable problems solved in 6 minutes

Convolutional neural network (IV) - special applications: face recognition and neural style transformation
随机推荐
Mysql45 talks about transaction isolation: why can't I see it after you change it?
[day_020419] inverted string
Intelligent fire protection application based on fire GIS system
Kingbasees SQL language reference manual of Jincang database (10. Query and sub query)
Interpretation of TPS motion (cvpr2022) video generation paper
递归处理——子问题
语法泛化三种可行方案介绍
Byte interview question - judge whether a tree is a balanced binary tree
Mysql45 talking about infrastructure: how is an SQL query executed?
Introduction of four redis cluster schemes + comparison of advantages and disadvantages
Implementation of PHP multitask second timer
数据库sql语言实战
Jincang database kingbasees SQL language reference manual (5. Operators)
[day_060423] no two
Should we test the Dao layer?
YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
[day_070425] legal bracket sequence judgment
Flex layout
Latex同时合并表格的多行多列
Kingbasees SQL language reference manual of Jincang database (7. Conditional expression)