精确中文数字、混合单位、句子转换与可配置人民币金额
///|
test "financial money parser roundtrip and canonical rejection" {
for i in -2000..<2000 {
assert_eq(
@cnnum.parse_money(@cnnum.format_money(i.to_int64())),
i.to_int64(),
)
}
for s in ["一元整", "负零元整", "壹元伍分伍分", "壹元"] {
assert_true(
try {
ignore(@cnnum.parse_money(s))
false
} catch {
_ => true
},
)
}
}fn format_currency(source : String, zero_yuan? : Bool, yuan? : String, whole_suffix? : String, prefix? : String, rounding? : String, parentheses? : Bool) -> String raise NumberErrorfn transform_spans(source : String, direction? : String, direct? : Bool) -> Array[NumberSpan] raise NumberErrorInstall
Download zip精确中文数字、混合单位、句子转换与可配置人民币金额