diff --git a/src/input.rs b/src/input.rs index fbe8316..c4ba76e 100644 --- a/src/input.rs +++ b/src/input.rs @@ -75,3 +75,13 @@ where .map(|n| n.parse().unwrap()) .collect() } + +/// Parses a string of separated elements with given character and returns them +/// as a collection. +pub fn parse_separated(c: char, s: &str) -> B +where + B: FromIterator, + ::Err: Debug, +{ + s.split(c).map(|n| n.parse().unwrap()).collect() +}