当前位置:网站首页>Convert amount figures to uppercase
Convert amount figures to uppercase
2022-07-26 06:21:00 【weixin_ thirty-eight million six hundred and seventy-three thou】
One 、 design sketch :

Two 、 Code block
computeLen(number){
let ret = ''
if (number !== '' && number != null && number !== '0') {
let unit = ' Ten billion yuan and ten thousand yuan and ten cents '
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 +=
' One two three four five six seven eight nine '.charAt(number.charAt(i)) + unit.charAt(i)
}
ret =
str
.replace(/ zero ( Thousand | Bai | Ten | horn )/g, ' zero ')
.replace(/( zero )+/g, ' zero ')
.replace(/ zero ( ten thousand | Billion | element )/g, '$1')
.replace(/( Billion ) ten thousand |( Ten )/g, '$1$2')
.replace(/^ Yuan zero ?| Zero point /g, '')
.replace(/ element $/g, ' element ') + ' whole '
}
this.model.taxNotIncludedCapital = ret
},
边栏推荐
- 【Day02_0419】C语言选择题
- C language explanation series - comprehensive exercises, guessing numbers games
- Do it yourself smart home: intelligent air conditioning control
- VRRP principle and basic commands
- [pytorch] fine tuning technology
- YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
- Should we test the Dao layer?
- Calling mode and execution sequence of JS
- Operating steps for uninstalling the mobile app
- What is the concept and purpose of white box testing? And what are the main methods?
猜你喜欢

Multi target detection

YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
![[pytorch] picture enlargement](/img/79/2eeefcb4623156f65957d78997e138.jpg)
[pytorch] picture enlargement

JVM class loading and GC garbage collection mechanism

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

YOLOv6:又快又准的目标检测框架开源啦

BPG笔记(四)

VRRP protocol and experimental configuration

Yolov6: the fast and accurate target detection framework is open source

Code runner for vs code, with more than 40million downloads! Support more than 50 languages
随机推荐
BigDecimal变为负数
nuxt 配置主题切换
【C语言】文件操作
Huawei cloud koomessage is a new marketing weapon in the hot public beta
H. Take the elevator greedy
【Day_01 0418】删除公共字符串
【Day_05 0422】连续最大和
[day_040421] binary conversion
Servlet cannot directly obtain JSON format data in request request
【Day_07 0425】Fibonacci数列
Embedded sharing collection 15
Acquisition of bidding information
[pytorch] picture enlargement
[day06_0423] C language multiple choice questions
Convolutional neural network (II) - deep convolutional network: case study
Convolutional neural network (IV) - special applications: face recognition and neural style transformation
将金额数字转换为大写
A tool for quickly switching local host files -- switchhosts
Implementation of PHP multitask second timer
[day_020419] inverted string