Created
July 11, 2018 22:23
-
-
Save rust-play/f3a9821dcc27d3b3313eb5afe0ee90c6 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
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