pub fn sum(
values: Vec<impl Into<String> + Clone>,
) -> Result<String, &'static str>Expand description
Sum of all values given a Vec
Example:
let data: Vec<String> = [100.325, 40.272, 51.23]
.map(|c| c.to_string())
.to_vec();
assert_eq!(string_calc::sum(data).unwrap(), "191.827".to_owned());
let data2 = vec!["20.0", "17", "28"];
assert_eq!(string_calc::sum(data2).unwrap(), "65".to_owned());