diff --git a/README.md b/README.md index 95f0313..9155101 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # ntext-rs +[![Documentation](https://github.com/uttarayan21/ntext-rs/actions/workflows/docs.yaml/badge.svg)](https://github.com/uttarayan21/ntext-rs/actions/workflows/docs.yaml) +[![Rust Build Test](https://github.com/uttarayan21/ntext-rs/actions/workflows/rust.yaml/badge.svg)](https://github.com/uttarayan21/ntext-rs/actions/workflows/rust.yaml) + Documentation of [ntext-rs](https://uttarayan21.github.io/ntext-rs) generated by cargo doc. A rust library to get numbers (usize) as words diff --git a/src/formatting.rs b/src/formatting.rs index a41cdaf..6fe95e9 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -30,7 +30,7 @@ impl<'format> Formatting<'format> { tens_seperator: None, } } - /// With same formatting for all + /// With same formatting for all seperators pub fn with_seperator(seperator: &'format str) -> Self { Self { capitalize: false, diff --git a/src/numtext.rs b/src/numtext.rs index b286998..e921fe8 100644 --- a/src/numtext.rs +++ b/src/numtext.rs @@ -47,6 +47,12 @@ fn place_value(number: u8, place: u8, fmt: &Formatting) -> Option { 4 => buffer.push_str("Thousand"), 5 => (), // Souldn't happen 6 => buffer.push_str("Million"), + 7 => (), + 8 => (), + 9 => buffer.push_str("Billion"), + 10 => (), + 11 => (), + 12 => buffer.push_str("Trillion"), _ => (), }; } else { @@ -57,6 +63,12 @@ fn place_value(number: u8, place: u8, fmt: &Formatting) -> Option { 4 => buffer.push_str("thousand"), 5 => (), // Souldn't happen 6 => buffer.push_str("million"), + 7 => (), + 8 => (), + 9 => buffer.push_str("billion"), + 10 => (), + 11 => (), + 12 => buffer.push_str("trillion"), _ => (), } } @@ -139,7 +151,7 @@ fn tens_place(tens: u8, ones: u8, fmt: &Formatting) -> Option { pub fn to_text_fmt(number: usize, fmt: &Formatting) -> String { let mut numtext: String = String::new(); let mut last: Option = None; - let tens_place_holders: [u8; 3] = [2, 5, 7]; + let tens_place_holders: [u8; 4] = [2, 5, 7, 10]; let digits: Vec = number .to_string() .chars()