htmgo/examples/hackernews/internal/parse/parse.go

12 lines
175 B
Go
Raw Normal View History

2024-10-11 01:17:31 +00:00
package parse
import "strconv"
func MustParseInt(s string, fallback int) int {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return fallback
}
return int(v)
}