3 个版本
0.1.2 | 2023 年 5 月 23 日 |
---|---|
0.1.1 | 2023 年 5 月 20 日 |
0.1.0 | 2023 年 5 月 20 日 |
#2272 in 命令行工具
59KB
1K SLoC
Numbers into words
将整数转换为英文单词。
许可证:MIT OR Apache-2.0
命令行参考
- 用法:
target/debug/numbers_into_words [选项] [数字]
选项
-
--help
: 显示帮助信息 -
--and=
(none
|last
|below1k
|all
): 指定何时在短语如 "five-hundred and seventy-two" 中使用单词 "and" -
--and-help
: 描述--and=
的选项 -
--minimal
: 仅输出每个数字的单词(而不是以数字开头,例如 "five" 而不是 "5: five")
"and" 选项
-
--and=none
: 不使用单词 "and"(例如 "five-hundred seventy-two") -
--and=last
: 仅在百位、十位和个位组中使用单词 "and"(例如 "three-hundred five thousand, five-hundred and seventy-two",但 "three-hundred five million, five-hundred seventy-two thousand") -
--and=below1k
: 仅对小于 1000 的数字使用单词 "and"(例如 "three-hundred five thousand, five-hundred seventy-two",但 "three-hundred and five") -
--and=all
: 总是使用 "and"(默认行为)(例如 "five-hundred and twenty-four million, three-hundred and seventy-eight")
用法示例
$ numbers_into_words 234 92,582,349 543_953_459_343 8
234: two-hundred and thirty-four
92582349: ninety-two million, five-hundred and eighty-two thousand, three-hundred and forty-nine
543953459343: five-hundred and forty-three billion, nine-hundred and fifty-three million, four-hundred and fifty-nine thousand, three-hundred and forty-three
8: eight
$ numbers_into_words --minimal 593_123 45,230
five-hundred and ninety-three thousand, one-hundred and twenty-three
forty-five thousand, two-hundred and thirty
$ numbers_into_words --minimal --and=last 532_428_000 1000355
five-hundred thirty-two million, four-hundred twenty-eight thousand
one million, three-hundred and fifty-five
$ numbers_into_words -and=below1k 400_000_000_123 678
400000000123: four-hundred billion, one-hundred twenty-three
678: six-hundred and seventy-eight