Created
February 26, 2018 00:17
-
-
Save benjamintanweihao/9d31980378ee86d6733f3ca53e140691 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
fn main() { | |
let s1 = "x=123, y = 345, rule = B21/S334"; | |
let s2 = s1.replace(" ", ""); | |
let s3 = s2.split(',').collect::<Vec<_>>(); | |
let s4 = &s3[0..2]; | |
let s5 = s4.iter() | |
.flat_map(|&x| x.split('=').collect::<Vec<_>>()) | |
.collect::<Vec<_>>(); | |
println!("x = {:?}", s5[1]); | |
println!("y = {:?}", s5[3]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment