Skip to content

Instantly share code, notes, and snippets.

@dns2utf8
Last active January 5, 2020 23:31
Show Gist options
  • Save dns2utf8/799fc958afae896ab40735cfdbb0df21 to your computer and use it in GitHub Desktop.
Save dns2utf8/799fc958afae896ab40735cfdbb0df21 to your computer and use it in GitHub Desktop.
// 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);
}
@dns2utf8
Copy link
Author

dns2utf8 commented Jan 5, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment