/// Converts positive integers to (upper case) Roman numerals.
/// - `number`: The number that should be converted.
/// - `casing`: Indicates the casing the result should have.
Converts positive integers to (upper case) Roman numerals.
`number`: The number that should be converted.
`casing`: Indicates the casing the result should have.
Converts positive integers to ( upper case ) Roman numerals . ` number ` : The number that should be converted . ` casing ` : Indicates the casing the result should have .
pub fn to_roman_numerals(number: u32, casing: Casing) -> String {
    use core::iter::once;
    let thousands = number / 1000;
    let hundreds = (number / 100) % 10;
    let tens = (number / 10) % 10;
    let ones = number % 10;
    let upper_case = once("M")
        .cycle()
        .take(thousands as usize)
        .chain(once(ROMAN_NUMBER_MAP_HUNDREDS[hundreds as usize]))
        .chain(once(ROMAN_NUMBER_MAP_TENS[tens as usize]))
        .chain(once(ROMAN_NUMBER_MAP_ONES[ones as usize]))
        .collect();
    if casing == Casing::Upper {
        upper_case
    } else {
        upper_case.to_lowercase()
    }
}
pub fn to_roman_numerals ( number : u32 , casing : Casing ) -> String { use core :: iter :: once ; let thousands = number / 1000 ; let hundreds = ( number / 100 ) % 10 ; let tens = ( number / 10 ) % 10 ; let ones = number % 10 ; let upper_case = once ( " " ) . cycle ( ) . take ( thousands as usize ) . chain ( once ( ROMAN_NUMBER_MAP_HUNDREDS [ hundreds as usize ] ) ) . chain ( once ( ROMAN_NUMBER_MAP_TENS [ tens as usize ] ) ) . chain ( once ( ROMAN_NUMBER_MAP_ONES [ ones as usize ] ) ) . collect ( ) ; if casing == Casing :: Upper { upper_case } else { upper_case . to_lowercase ( ) } }
Converts positive integers to (upper case) Roman numerals.
Converts positive integers to ( upper case ) Roman numerals .
number
u32
casing
Casing