diff --git a/src/misc.rs b/src/misc.rs index dedf687..377f477 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -180,13 +180,18 @@ pub fn newtons_method( output_list } +/// Parses a json array of strings into a single, multiline string pub fn parse_value(value: &serde_json::Value) -> String { + // Create vector of strings let string_vector: Vec<&str> = value .as_array() .unwrap() .iter() .map(|ele| ele.as_str().unwrap()) .collect::>(); + + + // Deliminate vector with a new line and return the resulting multiline string string_vector .iter() .fold(String::new(), |s, l| s + l + "\n")