pub fn checked_sub(
lhs: impl Into<String>,
rhs: impl Into<String>,
) -> Result<String, &'static str>Expand description
Performs checked_sub on floating points. Inherits the checked_sub 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 = "192.168";
let rhs = "172.28";
assert_eq!(string_calc::checked_sub(lhs, rhs).unwrap(),
"19.888".to_owned());