Skip to main content

extract_note

Function extract_note 

Source
pub fn extract_note(title: &str) -> (String, Option<String>)
Expand description

Extract a parenthetical note from a title string.

Matches Ruby doing behavior: extracts everything from the first ( to the last ) as a note, but only when the string ends with ).

Empty parentheticals () are ignored and do not produce a note.

ยงExamples

let (title, note) = extract_note("Working on project (some context)");
assert_eq!(title, "Working on project");
assert_eq!(note.unwrap(), "some context");