Split with two different seperators instead of replacing first
This commit is contained in:
parent
4aa5bd00f9
commit
308ddd0de4
|
@ -75,8 +75,7 @@ fn overlaps((a, b): &(Elf, Elf)) -> bool {
|
||||||
// Transform from line to pair of Elfs
|
// Transform from line to pair of Elfs
|
||||||
fn transform(s: &str) -> (Elf, Elf) {
|
fn transform(s: &str) -> (Elf, Elf) {
|
||||||
let transformed = s
|
let transformed = s
|
||||||
.replace("-", ",")
|
.split([',', '-'])
|
||||||
.split(',')
|
|
||||||
.flat_map(|value| value.parse::<u32>())
|
.flat_map(|value| value.parse::<u32>())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user