move text stuff to json

This commit is contained in:
Simon Gardling
2022-03-10 16:03:13 -05:00
parent 1fd234d33d
commit 781aced325
9 changed files with 72 additions and 47 deletions

View File

@@ -179,3 +179,17 @@ pub fn newtons_method(
}
output_list
}
pub fn parse_value(value: &serde_json::Value) -> String {
let string_vector: Vec<&str> = value
.as_array()
.unwrap()
.iter()
.map(|ele| ele.as_str().unwrap())
.collect::<Vec<&str>>();
string_vector
.iter()
.fold(String::new(), |s, l| s + l + "\n")
.trim()
.to_string()
}