#numeral #roman #convert #prelude #represents

romans

Utility to convert and represent Roman numerals

1 unstable release

0.1.0 Aug 5, 2024

#210 in Value formatting

Custom license

23KB
367 lines

romans

A roman numeral convertor

Example

use romans::prelude::*;

fn main() -> Result<()> {
    assert_eq!(123, Numeral::try_from("cxxiii")?.value());
    assert_eq!(
        "cxxiii",
        Numeral::from(123)
            .as_string()
            .to_lowercase()
    );
    Ok(())
}

lib.rs:

Romans

This crate is an utility to convert and represent Roman numerals.

Example

use romans::prelude::*;

assert_eq!(123, Numeral::try_from("cxxiii").unwrap().value());
assert_eq!("CXXIII", Numeral::from(123).as_string());

Dependencies

~295–760KB
~18K SLoC