Last active
January 5, 2020 23:31
-
-
Save dns2utf8/799fc958afae896ab40735cfdbb0df21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://gist.github.com/dns2utf8/799fc958afae896ab40735cfdbb0df21 | |
fn main() { | |
let num = "0x2a"; | |
let parsed = | |
usize::from_str_radix(num.trim_start_matches("0x"), 16).expect("unable to parse num"); | |
println!("Hello, {}!", parsed); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run on play.rust-lang.org