Skip to content

Instantly share code, notes, and snippets.

Created August 21, 2017 12:15
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 anonymous/1fc14fe6540c7d047bb3d120a64a4818 to your computer and use it in GitHub Desktop.
Save anonymous/1fc14fe6540c7d047bb3d120a64a4818 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
fn main() {
let string = "Rust41Fun".to_string();
let res = string.chars().skip_while(|c| !c.is_digit(10)).collect::<String>();
let res = i32::from_str_radix(&res[0..1], 10);
match res {
Ok( i) => { println!("{}", i) },
Err(e) => { println!("Err: {}", e) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment