13 releases
| 0.2.1 | Jun 19, 2026 |
|---|---|
| 0.2.0 | Jun 3, 2026 |
| 0.1.6 | Sep 11, 2017 |
| 0.1.5 | May 14, 2015 |
| 0.0.4 | Mar 29, 2015 |
#733 in Text processing
1,221 downloads per month
Used in 2 crates
6KB
110 lines
roman
A Rust library to convert between integers and roman numerals.
Usage
Add to Cargo.toml:
[dependencies]
roman = "0.2"
assert_eq!(roman::to(14), Some("XIV".to_string()));
assert_eq!(roman::from("XIV"), Some(14));
assert_eq!(roman::to(0), None); // out of range
assert_eq!(roman::from("XIIII"), None); // non-canonical
assert_eq!(roman::to_lower(14), Some("xiv".to_string()));
assert_eq!(roman::from_lower("xiv"), Some(14));
Valid range: 1 to roman::MAX (3999).
Both functions return None outside that range.
from rejects non-canonical forms (e.g. IIII instead of IV).