Basic currency and number formatting library.
Here are some examples which illustrate the library functionality. Please read the documentation as well ```
use crate::Lotus::*; // Builder format (recommended) let rupee = LotusBuilder::default() .symbol("Rs.") .precision(1) .formatpositive("%s %v") .formatnegative("%s (%v)") .formatzero("%s 0.00") .decimalstr(".") .thousandstr(" ") .build() .unwrap(); asserteq!("Rs. 2 000 000.0", rupee.format(2000000)); asserteq!("Rs. (2 000.0)", rupee.format(-2000)); asserteq!("Rs. 0.00", rupee.format(0));
// Using Lotus::new() let dollar = Lotus::new("$", 3); // Lotus::new(symbol, precision) asserteq!("$ 50,000.035", dollar.format(50000.035));
// Using lotus! macro let f = lotus!(150, "$"); // lotus!(number, symbol) assert_eq!("$ 150.00", f);
let g = lotus!(2000000); // lotus!(number) assert_eq!("2,000,000.00", g); ```