aoc2024/day-04/internal/util/util.go

22 lines
298 B
Go
Raw Normal View History

2024-12-05 01:31:44 +00:00
package util
import (
"bufio"
"io"
)
func ReadLines(r io.Reader) ([]string, error) {
lines := []string{}
scanner := bufio.NewScanner(r)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
if err := scanner.Err(); err != nil {
return []string{}, err
}
return lines, nil
}