diff options
author | j-james | 2022-12-01 11:37:15 +0000 |
---|---|---|
committer | j-james | 2022-12-01 11:37:15 +0000 |
commit | 13b3ae4211631c74b9249a6033869f75e036fad2 (patch) | |
tree | 2a0e423912b640cc02c7b08bf47db8ba5bfaf07f /2020/four.nim | |
parent | 926b0949d12588641f29836a6e41712b3237b1b9 (diff) |
Clean up 2020 code
like seriously nim has ufcs what was past me thinking
Diffstat (limited to '2020/four.nim')
-rw-r--r-- | 2020/four.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/2020/four.nim b/2020/four.nim index 89bc335..c469297 100644 --- a/2020/four.nim +++ b/2020/four.nim @@ -4,12 +4,12 @@ import os, strutils let input: string = paramStr(1) var fieldedPassports, validPassports: int = 0 -for passport in split(readFile(input), "\n\n"): +for passport in input.readFile().split("\n\n"): var fields, valid: int = 0 - for pairs in split(strip(replace(passport, "\n", " ")), " "): + for pairs in passport.replace("\n", " ").strip().split(" "): let - key: string = split(pairs, ":")[0] - value: string = split(pairs, ":")[1] + key: string = pairs.split(":")[0] + value: string = pairs.split(":")[1] case key of "byr": if parseInt(value) in 1920 .. 2002: |