Skip to content

Instantly share code, notes, and snippets.

@dresswithpockets
Created April 9, 2017 05:39
Show Gist options
  • Save dresswithpockets/e233c6cd4da92656bb611600314e6388 to your computer and use it in GitHub Desktop.
Save dresswithpockets/e233c6cd4da92656bb611600314e6388 to your computer and use it in GitHub Desktop.
pub fn sub(str: &String, a: usize, b: usize) -> String {
str[a .. str.char_indices().nth(b).unwrap().0].to_owned()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment