| Crates.io | num2ordinal |
| lib.rs | num2ordinal |
| version | 0.1.2 |
| created_at | 2024-12-15 08:17:02.067102+00 |
| updated_at | 2024-12-15 15:48:29.416753+00 |
| description | A simple Rust crate for converting integers to ordinal representations, including support for alphabetic and Roman numeral formats. |
| homepage | |
| repository | https://github.com/shiueo/num2ordinal |
| max_upload_size | |
| id | 1484005 |
| size | 11,388 |
A simple Rust crate for converting integers to ordinal representations, including support for alphabetic and Roman numeral formats.
Add this to your Cargo.toml:
[dependencies]
num2ordinal = "0.1"
The to_alphabet function converts an integer to its corresponding alphabetic representation, following the Excel-style column naming convention.
use num2ordinal::alphabet::to_alphabet;
fn main() {
let num = 1999;
let alphabet = to_alphabet(num);
println!("Alphabetic representation for {} is {}", num, alphabet);
// Alphabetic representation for 1999 is BXW
}
use num2ordinal::roman::to_roman;
fn main() {
let num = 1999;
let roman = to_roman(num);
println!("Roman numeral for {} is {}", num, roman);
// Roman numeral for 1999 is MCMXCIX
}
use num2ordinal::extended_roman::to_extended_roman;
fn main() {
let num = 14000;
let extended_roman = to_extended_roman(num);
println!("Extended Roman numeral for {} is {}", num, extended_roman);
// Extended Roman numeral for 14000 is X̄ĪV̄
}
This crate is licensed under the MIT license. See LICENSE for more details.