Crate ntext[−][src]
extern crate ntext; use ntext::digit_to_text; fn main() { println!("{}",digit_to_text(1).unwrap()); assert_eq!("two",digit_to_text(2).unwrap()); assert_ne!("five",digit_to_text(8).unwrap()); }
However giving the program a zero will return an empty string.
extern crate ntext; use ntext::to_text; fn main() { println!("{}",to_text!(1312)); assert_eq!(to_text!(1312),"onethousandthreehundredtwelve"); println!("{}",to_text!(7123)); assert_eq!(to_text!(7123," "),"seven thousand one hundred twenty three"); }
This macro will also return an empty string on input zero
Macros
| to_text | Macro which supports both seperator and without it |
Functions
| digit_to_text | Convert digit to words in a string. |
| to_text_no_seperator | Convert u32 to words in a string. |
| to_text_with_seperator | Convert u32 to words in a string seperated by a seperator. |