🚀 Convert Chinese Numerals To Arabic Numerals With Julia Language.
You can learn by referring to the functions of this libray: cn2an.
## In Julia REPL
julia> ]
pkg> add Cn2An
# or
pkg> add https://github.com/Ailln/Cn2An.jl
## In Julia file and REPL
using Pkg
Pkg.add("Cn2An")
# or
Pkg.add(PackageSpec(url="https://github.com/Ailln/Cn2An.jl"))
import Cn2An:cn2an
import Cn2An:an2cn
println(cn2an("一百二十三"))
# 123
println(an2cn(123))
# 一百二十三
Compare the performance of cn2an function running one million times on Python and Julia respectively.
NO. | language | function | times | cost(s) | code |
---|---|---|---|---|---|
1 | Python | an2cn core | 1000000 | 7.379 | an2cn |
2 | Julia | an2cn core | 1000000 | 2.822 | an2cn |
From the results, we can see that Julia is almost three times faster!