Browse Source

Initial workup with str splitting

master
Jim Infield 3 years ago
parent
commit
0815fd3bb7
  1. 25
      src/main.rs

25
src/main.rs

@ -8,10 +8,27 @@ fn main() {
println!(); println!();
for arg in args {
println!("{:?}\n{:?}\n", arg, stati(arg));
};
// for arg in args {
// println!("{:?}\n{:?}\n", arg, stati(arg));
// };
let strings = args[0];
let mut times = vec![];
for t in strings.split(", ") {
let e: Vec<_> = t.split('|')
.map(|i| i.parse::<i32>().unwrap())
.collect();
times.push(e[0]*3600 + e[1]*60 + e[2])
}
let times_orig = times.clone();
times.sort();
println!("\n{:?}\n{:?}\n{:?}\n",
times_orig,
times,
times.iter().sum::<i32>(),
);
println!(); println!();
} }

Loading…
Cancel
Save