Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust from floating point to money

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

fn main() {
    println!("{}", money_string(123.45));
}
 
PREVIOUS NEXT
Tagged: #rust #floating #point #money
ADD COMMENT
Topic
Name
7+1 =