-
-
Save hoodie/298e54ed1e1ecd1ee60c to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or 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 a = [1,2,3,4,5,6,7,8,9,0]; | |
let b = "hello world!"; | |
let slice_a = &a[6..]; // [7,8,9,0] | |
let slice_b = &b[6..11]; // "world" | |
let slice_c = &slice_b[..2]; // "wo" | |
println!("{:?}", a); println!("{:?}", slice_a); | |
println!("{:?}", b); println!("{:?}", slice_b); println!("{:?}", slice_c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment