d0004 /
它可以拼写数字(和货币)!
dev-master
2024-06-03 13:49 UTC
Requires
- php: >=7.1
This package is auto-updated.
Last update: 2024-09-03 14:29:37 UTC
README
这是一个通用库,用于数字拼写,适用于例如法律文件和账单。
支持的语言(ISO 639-1 语言代码)
- 英语(
en
) - 爱沙尼亚语(
et
) - 拉脱维亚语(
lv
) - 立陶宛语(
lt
) - 俄语(
ru
) - 西班牙语(
es
) - 意大利语(
it
) - 波兰语(
pl
) - 挪威语(
no
)
支持货币(ISO 4217 货币代码)
- 英镑(
GBP
) - 欧元(
EUR
) - 拉脱维亚立特(
LVL
) - 立陶宛立特(
LTL
) - 俄罗斯卢布(
RUR
) - 美元(
USD
) - 波兰兹罗提(
PLN
) - 坦桑尼亚先令(
TZS
) - 挪威克朗(
NOK
)
安装
composer require jurchiks/numbers2words
用法
use js\tools\numbers2words\Speller; Speller::spellNumber(123, Speller::LANGUAGE_RUSSIAN); // output: сто двадцать три Speller::spellCurrency(123, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO, false); // output: one hundred twenty three euro Speller::spellCurrency(123, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO); // output: one hundred twenty three euro and 0 cents Speller::spellCurrency(123.45, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO, true, true); // output: one hundred twenty three euro and forty five cents Speller::spellCurrencyShort(123.45, Speller::LANGUAGE_ENGLISH, Speller::CURRENCY_EURO); // output: one hundred twenty three EUR 45/100
Twig
此库有一个可用的Twig扩展: jurchiks/numbers2words_twig