[−][src]Crate ntext
Example program with default formatting Source ntext-rs
extern crate ntext; use ntext::to_text; fn main() { assert_eq!(to_text!(7123),"Seven Thousand,One Hundred,Twenty-Three"); assert_eq!(to_text!(1000),"One Thousand"); }
Example program with custom formatting
extern crate ntext; use ntext::{Formatting,to_text}; fn main() { assert_eq!(to_text!(1000, &Formatting::none().capitalize()),"OneThousand"); assert_eq!(to_text!(34123, &Formatting::with_seperator("#").capitalize()),"Thirty#Four#Thousand#One#Hundred#Twenty#Three"); }
This macro will also return an empty string on input zero You can also create the Formatting struct manually
Macros
| to_text | Macro which supports both seperator and without it |
Structs
| Formatting | Set the formatting of the output |
Functions
| digit_to_text | Convert digit to words in a string. |
| to_text_fmt | Convert usize to words in a string seperated by a seperator. |