go-countlines/countlines_go.go

14 lines
228 B
Go

package countlines
//func countNewlinesGo(s []byte) uint64 {
//return uint64(bytes.Count(s, []byte{'\n'}))
//}
func countNewlinesGo(s []byte) (out uint64) {
for _, x := range s {
if x == '\n' {
out += 1
}
}
return
}