Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rosbit/cn-capitalizer

数字中文大写。支持金额、年/月/日,符合国家合同规范、支票规范。一遍扫描完成转换,支持整型/浮点型/字符串等类型,支持正负数。
https://github.com/rosbit/cn-capitalizer

cheque-month-day digit-cn-capitalizer money-amount

Last synced: about 6 hours ago
JSON representation

数字中文大写。支持金额、年/月/日,符合国家合同规范、支票规范。一遍扫描完成转换,支持整型/浮点型/字符串等类型,支持正负数。

Awesome Lists containing this project

README

        

## 数字转为中文大写

一遍扫描,全程无替换操作。

1. 金额
- 可以转换到`万万亿`级别
- 如有需要,可以在单位中追加更高级别
1. 年份
- 2021可以转为“贰零贰壹”或“贰仟零贰拾壹”
1. 月份
- 支持支票规范的月份,如10月转为“零拾”月
- 普通月份支持,如10月转为“拾”月
1. 日份
- 支持支票规范的日份,如20日转为“零贰拾”日
- 普通日份支持,如20日转为“廿”日

### 使用方法
- 见测试程序`currency_test.go`、`date_test.go`
```bash
$ go test
----- 金额 ----
435235324532.00 => 肆仟叁佰伍拾贰亿叁仟伍佰叁拾贰万肆仟伍佰叁拾贰元整
100.02 => 壹佰元零贰分
100.20 => 壹佰元零贰角
10.23 => 壹拾元零贰角叁分
101.23 => 壹佰零壹元贰角叁分
101.03 => 壹佰零壹元零叁分
10100.02 => 壹万零壹佰元零贰分
340210100.02 => 叁亿肆仟零贰拾壹万零壹佰元零贰分
-340210100.02 => 负叁亿肆仟零贰拾壹万零壹佰元零贰分
3400000000.02 => 叁拾肆亿元零贰分
3400000.02 => 叁佰肆拾万元零贰分
4352352343400000000.00 => 肆佰叁拾伍万万亿贰仟叁佰伍拾贰万亿叁仟肆佰叁拾肆亿元整
14352352343400000000 => 壹仟肆佰叁拾伍万万亿贰仟叁佰伍拾贰万亿叁仟肆佰叁拾肆亿元整
214352352343399989248.00 => 超大数字
-214352352343399989248.00 => 超小数字
0.00 => 零元整
0.12 => 壹角贰分
9999 => 玖仟玖佰玖拾玖元整
19800 => 壹万玖仟捌佰元整
2980 => 贰仟玖佰捌拾元整
500200 => 伍拾万零贰佰元整
103 => 壹佰零叁元整
32766 => 叁万贰仟柒佰陆拾陆元整
-100.23 => 负壹佰元零贰角叁分
0 => 零元整
---- 年份 ----
2021 => 贰仟零贰拾壹 (with base)
2021 => 贰零贰壹 (without base)
19800 => 壹万玖仟捌佰 (with base)
19800 => 壹玖捌零零 (without base)
2980 => 贰仟玖佰捌拾 (with base)
2980 => 贰玖捌零 (without base)
500200 => 伍拾万零贰佰 (with base)
500200 => 伍零零贰零零 (without base)
103 => 壹佰零叁 (with base)
103 => 壹零叁 (without base)
32766 => 叁万贰仟柒佰陆拾陆 (with base)
32766 => 叁贰柒陆陆 (without base)
0 => 零 (with base)
0 => 零 (without base)
-100 => 公元前壹佰 (with base)
-100 => 公元前壹零零 (without base)
---- 月份 ----
-1 => 超小数字
0 => 超小数字
1 => 壹
9 => 玖
10 => 拾
11 => 拾壹
12 => 拾贰
13 => 超大数字
---- 日份 ----
-1 => 超小数字
0 => 超小数字
1 => 壹
9 => 玖
10 => 拾
11 => 拾壹
12 => 拾贰
20 => 廿
21 => 廿壹
30 => 卅
31 => 卅壹
32 => 超大数字
---- 用于支票的月份 ----
0 => 超小数字
1 => 零壹
10 => 零拾
11 => 壹拾壹
12 => 壹拾贰
13 => 超大数字
---- 用于支票的日份 ----
0 => 超小数字
1 => 零壹
10 => 零拾
19 => 壹拾玖
20 => 零贰拾
29 => 贰拾玖
30 => 零叁拾
31 => 叁拾壹
32 => 超大数字
PASS
ok cn-capitalizer 0.145s
```