1 unstable release
0.1.0 | Nov 29, 2024 |
---|
#97 in Internationalization (i18n)
127 downloads per month
7KB
82 lines
Num2Persian
A Rust library for converting numbers to their Persian representation.
Features
- Converts numbers to Persian text.
- Supports ordinal numbers (e.g., "fifth" in Persian).
- Handles large numbers up to trillions.
Installation
Add the following to your Cargo.toml
:
[dependencies]
rsnum2persian = "0.1.0"
Usage
use rsnum2persian;
fn main() {
let mut level = 0;
println!("{}", persian_number_converter::num_to_persian(5678, &mut level, false));
// Output: پنج هزار و ششصد و هفتاد و هشت
}
Ordinal Numbers
use rsnum2persian;
fn main() {
let mut level = 0;
println!("{}", persian_number_converter::num_to_persian(5678, &mut level, true));
// Output: پنج هزار و ششصد و هفتاد و هشتم
}
Running Examples
This library includes an example demonstrating its usage:
cargo run --example main