Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. fn main() {
  2. let info_lines = "foo bar\ngoo jar\ntoo far\n";
  3. let lines_containing_goo = info_lines.split("\n").filter(|line|
  4. match line.split_whitespace().next() {
  5. Some(word) => word.contains("goo"),
  6. None => false,
  7. }
  8. );
  9.  
  10. for info_line in lines_containing_goo {
  11. println!("{}", info_line);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement