Split with two different seperators instead of replacing first

This commit is contained in:
Dreaded_X 2022-12-06 05:27:57 +01:00
parent 4aa5bd00f9
commit 308ddd0de4
Signed by: Dreaded_X
GPG Key ID: 76BDEC4E165D8AD9

View File

@ -75,8 +75,7 @@ fn overlaps((a, b): &(Elf, Elf)) -> bool {
// Transform from line to pair of Elfs
fn transform(s: &str) -> (Elf, Elf) {
let transformed = s
.replace("-", ",")
.split(',')
.split([',', '-'])
.flat_map(|value| value.parse::<u32>())
.collect::<Vec<_>>();