Validate an integer before converting it
strtol
std::from_chars
strconv.ParseInt
Integer.parseInt
toIntOrNull and mapNotNull
filter_var and FILTER_VALIDATE_INT
ValueError
grepl and strtoi
Kernel#Integer
StringOps.toIntOption