From 0815fd3bb759aa969640741c2aebbca1339a10aa Mon Sep 17 00:00:00 2001 From: Jim Infield Date: Mon, 16 Aug 2021 15:43:56 -0500 Subject: [PATCH] Initial workup with str splitting --- src/main.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index bc9abe5..db08396 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,10 +8,27 @@ fn main() { 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::().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::(), + ); println!(); }