Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. fn main() {
  2. let input = "hello\nthere\nlol\ntrunc'd";
  3. let trunc = 3;
  4. let out = input.lines().take(trunc).map(|x| format!("{}\n", x)).collect::<String>();
  5.  
  6. println!("{}", out);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement