pub fn float(string: String) -> Result<f64, ParseFloatError>Expand description
Convert a String to float (f64)
ยงExamples
Basic usage
extern crate reader;
use reader::{input, float};
Reading a float (f64)
let salary = float(input("Enter your salary: ")).unwrap();
println!("Your salary is: {}", salary);
Reading a float (f32)
let salary = float(input("Enter your salary: ")).unwrap() as f32;
println!("Your salary is: {}", salary);