checked_mul

Function checked_mul 

Source
pub fn checked_mul(
    lhs: impl Into<String>,
    rhs: impl Into<String>,
) -> Result<String, &'static str>
Expand description

Performs checked_mul on floating points. Inherits the checked_mul property of rust in integers. When failed, it’ll return Err(message). Success, Ok(value).

NOTE: Must use basic numbers UTF-8 or it’ll fail.

Example:

let lhs = "12.35";
let rhs = "15.6";
 
assert_eq!(string_calc::checked_mul(lhs, rhs).unwrap(),
  "192.66".to_owned());