Skip to content

Instantly share code, notes, and snippets.

@dherman
Created March 3, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dherman/b9a51cc154a913a851c89f63126f6510 to your computer and use it in GitHub Desktop.
Save dherman/b9a51cc154a913a851c89f63126f6510 to your computer and use it in GitHub Desktop.
fn extract_usage(s: &str) -> &str {
let (start, _) = s.match_indices("Usage:").next().unwrap();
let s = &s[start..];
let (end, _) = s.match_indices("\n\n").next().unwrap();
let s = &s[..end];
s.trim()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment