fix person_name whitespace trim
@@ -132,7 +132,7 @@ impl<'a> PersonName<'a> {
/// When passing a text value to this function,
/// ensure that it contains a single DICOM formatted name.
pub fn from_str(slice: &'a str) -> PersonName<'a> {
- let mut parts = slice.split('^');
+ let mut parts = slice.trim().split('^');
macro_rules! get_component {
() => {
@@ -393,5 +393,15 @@ mod tests {
suffix: Some("B.A. M.Div."),
}
);
+ assert_eq!(
+ PersonName::from_str("Adams^ "),
+ PersonName {
+ prefix: None,
+ given: None,
+ middle: None,
+ family: Some("Adams"),
+ suffix: None,
+ }
+ );
}
}
