Answers for "split a line on whitespace"

0

split a line on whitespace

fn main() {
  let s = "line 1
  line 2
  line 3";
  let chunks:Vec<_> = s.split_whitespace().collect();

  println!("Sum of x and y = {:?} ", chunks);
}
Posted by: Guest on May-25-2021

Browse Popular Code Answers by Language