rust from floating point to money code example
Example: rust from floating point to money
fn money_string(amount: f64) -> String {
format!("${:.2}", amount)
}
fn main() {
println!("{}", money_string(123.45));
}
fn money_string(amount: f64) -> String {
format!("${:.2}", amount)
}
fn main() {
println!("{}", money_string(123.45));
}