Rust From Floating Point To Money

[Solved] Rust From Floating Point To Money | Haskell - Code Explorer | yomemimo.com
Question : rust from floating point to money

Answered by : mackerel

fn money_string(amount: f64) -> String { format!("${:.2}", amount)
}
fn main() { println!("{}", money_string(123.45));
}

Source : | Last Update : Sat, 20 Mar 21

Answers related to rust from floating point to money

Code Explorer Popular Question For Haskell