[−][src]Function numerus::numerus_lib::roman_to_int::roman_to_int
pub fn roman_to_int(number: &str) -> Option<i32>
Convert given roman numeral into an integer. This function accepts, at the same time, both uppercase and lowercase character.
The function fails if any invalid character is meet.
An error example
use numerus::roman_to_int; /* K is not a symbol in the roman numerical system */ let wrong_roman = "XCK"; match roman_to_int(wrong_roman) { Some(_) => assert!(false), None => assert!(true) }
A correct convertion
use numerus::roman_to_int; let wrong_roman = "MCMLXIX"; match roman_to_int(wrong_roman) { Some(arabic) => assert_eq!(1969, arabic), None => assert!(false) }