Skip to content

Commit

Permalink
#374 removing enclosing single quotes for string values
Browse files Browse the repository at this point in the history
  • Loading branch information
chrsoo authored and simonrw committed Jan 2, 2025
1 parent af6e89e commit 283eeec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fitsio/src/headers/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ impl Card {
Ok(unsafe { CStr::from_ptr(self.comment.as_ptr() as *mut c_char) }.to_str()?)
}

/// Header value as a &str.
/// Header value as a &str without enclosing quotes.
pub fn str_value(&self) -> Result<&str> {
Ok(unsafe { CStr::from_ptr(self.value.as_ptr() as *mut c_char) }.to_str()?)
let cstr = unsafe { CStr::from_ptr(self.value.as_ptr() as *mut c_char) };
let str = cstr.to_str()?.trim_matches('\'');
Ok(str)
}

pub(crate) fn set_comment(&mut self, comment: String) {
Expand Down

0 comments on commit 283eeec

Please sign in to comment.