Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created July 11, 2018 22:23
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 rust-play/f3a9821dcc27d3b3313eb5afe0ee90c6 to your computer and use it in GitHub Desktop.
Save rust-play/f3a9821dcc27d3b3313eb5afe0ee90c6 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
fn main() {
let message = "“It’s a smart quote!” 😛";
let new_message: String = message
.bytes()
.enumerate()
.map(|(i, c)| {
println!("[{:3}] = {:08b} = {:02x} = '{}'", i, c, c, c as char);
c as char
})
.collect();
println!("{}", new_message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment