You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
536 B

package day04
import (
"strings"
"git.elis.nu/etu/aoc2020/utils"
)
var rows []map[string]string
func ParseFile(input string) {
row := make(map[string]string)
// Parse file
for _, line := range utils.GetLinesFromFile("day04/" + input + ".txt") {
if line == "" {
rows = append(rows, row)
row = make(map[string]string)
continue
}
for _, part := range strings.Split(line, " ") {
parts := strings.Split(part, ":")
row[parts[0]] = parts[1]
}
}
// Don't forget the last item
rows = append(rows, row)
}