pub fn first_string(
fields: &HashMap<String, Vec<String>>,
key: &str,
) -> Option<String>Expand description
Get the first value of a field as an owned String.
ยงExamples
use std::collections::HashMap;
use openstranded_common_helpers::first_string;
let mut fields = HashMap::new();
fields.insert("name".into(), vec!["Wood".into()]);
assert_eq!(first_string(&fields, "name"), Some("Wood".into()));