Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let input = "hello\nthere\nlol\ntrunc'd";
- let trunc = 3;
- let out = input.lines().take(trunc).map(|x| format!("{}\n", x)).collect::<String>();
- println!("{}", out);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement