rsnum2persian

Crates.iorsnum2persian
lib.rsrsnum2persian
version0.1.0
sourcesrc
created_at2024-11-29 16:19:50.59204
updated_at2024-11-29 16:19:50.59204
descriptionA Rust library for converting numbers to their Persian representation.
homepagehttps://github.com/fadedreams/rsnum2persian
repositoryhttps://github.com/fadedreams/rsnum2persian
max_upload_size
id1465777
size7,807
fadedreams (fadedreams)

documentation

https://github.com/fadedreams/rsnum2persian

README

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
Commit count: 2

cargo fmt