SHARE
TWEET

Untitled

a guest Jul 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top