mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-09 14:20:48 +00:00
23 lines
350 B
Go
23 lines
350 B
Go
package two
|
|
|
|
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
|
|
}
|