aoc2024/day-23/internal/one/util.go

23 lines
350 B
Go
Raw Normal View History

2024-12-23 19:56:13 +00:00
package one
import (
"bufio"
"io"
"strings"
)
func parseLines(r io.Reader) ([][]string, error) {
connections := [][]string{}
scanner := bufio.NewScanner(r)
for scanner.Scan() {
connections = append(connections, strings.Split(scanner.Text(), "-"))
}
if err := scanner.Err(); err != nil {
return nil, err
}
return connections, nil
}